Skip to content

Defining emits removes them from attrs #4901

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

Closed
kreha1 opened this issue Nov 4, 2021 · 2 comments
Closed

Defining emits removes them from attrs #4901

kreha1 opened this issue Nov 4, 2021 · 2 comments

Comments

@kreha1
Copy link

kreha1 commented Nov 4, 2021

Version

3.2.21

Reproduction link

stackblitz.com

SFC Playground (the iframe has limited height, so stackblitz.com is recommended)

Steps to reproduce

Clicking on buttons will send the event if listener exists on attrs.
Uncomment emits to see the behaviour changing.

What is expected?

Either defining emits shouldn't remove onListener (where listener is the name of an event) from attrs, or there should be a way to check for listeners.

What is actually happening?

Defining event name removes the property from attrs, there's no way to check for declared listeners.

@LinusBorg
Copy link
Member

For now, if you want to check for declared listeners, define them as onX props instead. Props starting with on followed by an uppercase letter are considered event listeners.

@posva
Copy link
Member

posva commented Nov 4, 2021

Duplicate of #4736 (comment)

@posva posva marked this as a duplicate of #4736 Nov 4, 2021
@posva posva closed this as completed Nov 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants