Skip to content

vue3 $emit('event') popup #6433

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
fleeze opened this issue Aug 9, 2022 · 2 comments
Closed

vue3 $emit('event') popup #6433

fleeze opened this issue Aug 9, 2022 · 2 comments

Comments

@fleeze
Copy link

fleeze commented Aug 9, 2022

Vue version

vue3

Link to minimal reproduction

https://codesandbox.io/s/romantic-shannon-0qnp0t?file=/src/components/HelloWordInner.vue

Steps to reproduce

open link --> click button

What is expected?

do not log 'app,func' on console

What is actually happening?

log 'app,func' on console

System Info

No response

Any additional comments?

No response

@tbh-nine
Copy link

tbh-nine commented Aug 9, 2022

I experience the same issue in my app, even though the documentation clearly states that component emitted events do not bubble: https://vuejs.org/guide/components/events.html#emitting-and-listening-to-events.

Looks like a bug.

@posva
Copy link
Member

posva commented Aug 9, 2022

This is intended behavior because by default the emits get inherited by the child. You should either remove the @fun in App.vue or add inheritAttrs: false to HelloWorld.vue

SFC Playground


Remember to use the forum or the Discord chat to ask questions!

@posva posva closed this as completed Aug 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 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