-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
docs/src/guide/components/events.md
Line 225 in 1faadee
Although optional, it is recommended to define all emitted events in order to better document how a component should work. It also allows Vue to exclude known listeners from [fallthrough attributes](/guide/components/attrs#v-on-listener-inheritance), avoiding edge cases caused by DOM events manually dispatched by 3rd party code. |
avoiding edge cases caused by DOM events manually dispatched by 3rd party code
The problem is that these same listeners can also be triggered by custom events - in the above example, both a native click event and a custom one emitted by this.$emit('click') in the child will trigger the parent's foo handler. This may lead to unwanted behavior.
I don't quite understand why edge cases are caused by 3rd party code manually dispatch event?
If declare the events in emits option, should the events only manually dispatched by code be the target's behavior?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request