Explain different ways that props are treated in v3
Open
Nobody has claimed this yet.
discussion
- Dominant language
- Vue
- Stars
- 3.2k
- Forks
- 5k
- Avg merge
- 14d 17h
- Merged PRs (30d)
- 1
Description
In v3 v-on was merged with props, for that to happen props started with on* are treated as events
<Comp
@myEvent="log('myEvent')"
@my-event="log('my-event')"
:onMyEvent="()=>log('onMyEvent')"
/>
<! -- CONVERTED TO -->
h(Comp, {
onMyEvent: [
_cache[0] || (_cache[0] = $event => (log('myEvent'))),
_cache[1] || (_cache[1] = $event => (log('my-event'))),
()=>log('onMyEvent')
]
})
You can also declare events as props
defineComponent({
props: {
onClick: Function, // similar to emit: ['click']
}
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the v3 props and event examples in the issue and verify them in the linked playground. Update the relevant Vue documentation to explain how v-on handlers and on* props are treated, including declaring events as props; done means the examples and distinctions are clear to readers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100