-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Using the recommended emit attribute removes the event namespace from the component attributes #5319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Agreed, there are a few work arounds. However I feel that lacking a way to check what is an allowed emit, per the documentation, especially as it pertains to more complex examples with multiple events, makes the recommendation of using the
Wouldn't it add value to this feature to add the allowed emitted values to the attrs? Or, access them via $emits or $emittable. What is the technical or performance limitation to do so? |
make your case in the RFC discussion, if it wasn't already made. and don't hold your breath |
Duplicate of #5220 |
Version
3.2.29
Reproduction link
stackblitz.com
Steps to reproduce
Create a component.
In the component add the emits option:
emits: ['onDelete']
In the components template add an if statement to determine if the event is bound to the component
v-if="$attrs.onOnDelete"
In the parent add an event handler such as
@click="onDelete"
What is expected?
In the Vue3 docs it recommends to define what events a child component can emit to the parent https://v3.vuejs.org/guide/migration/emits-option.html#overview
If the parent binds the event onDelete I would expect the component to be displayed.
What is actually happening?
The component is not displayed.
See the discussion here: https://stackoverflow.com/questions/70272335/vue3-check-if-event-listener-is-bound-to-component-instance/70358655?noredirect=1#comment125169175_70358655
The text was updated successfully, but these errors were encountered: