Skip to content
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

How to stop click event from bubbling? #161

Closed
tiye opened this issue Mar 7, 2014 · 6 comments
Closed

How to stop click event from bubbling? #161

tiye opened this issue Mar 7, 2014 · 6 comments

Comments

@tiye
Copy link

tiye commented Mar 7, 2014

For DOM tree like this:

#outside(v-on='click: doOut')
  #inside(v-on='click: doIn')

clicking #inside triggers doOut too, despite of event.stopPropagation().
What is the right way to prevent events in Vue?

@jcaxmacher
Copy link

Can you share a JSFiddle showing this behavior?

@ghost
Copy link

ghost commented Mar 7, 2014

@th0r
Copy link

th0r commented Mar 7, 2014

I think it happens because of event delegation: all handlers are actually stored on some root node, and something like jQuery's event.stopImmediatePropagation() is needed here.

yyx990803 pushed a commit that referenced this issue Mar 7, 2014
@tiye
Copy link
Author

tiye commented Mar 8, 2014

Thanks, confirmed working for me.

@ggepenyan
Copy link

So how to fix it in vue if I'm not using jquery

@sirlancelot
Copy link

@ggepenyan This closed issue is 5+ years old and is no longer an issue. Use @click.stop="handler"

@vuejs vuejs locked as resolved and limited conversation to collaborators Apr 12, 2019
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

6 participants