Skip to content

Using the recommended emit attribute removes the event namespace from the component attributes #5319

Closed
@twickstrom

Description

@twickstrom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions