Quantcast
Channel: Active questions tagged propagation - Stack Overflow
Viewing all articles
Browse latest Browse all 46

Vue 3 - Prevent event propagation on custom event handlers

$
0
0

If i have a custom event handler like @my-event and i emit it with

this.$emit('my-event')

it calls all the events of @my-event from all parent components.But i want to prevent this.On normal event handlers like @click, we can simply add .stop behind it to prevent this behaviour.But .stop does not work on custom event listeners.

Fiddle without stop: https://jsfiddle.net/xn9sq4cp/

Fiddle with stop: https://jsfiddle.net/xy18mspz/

I know i can add

inheritAttrs: false

to prevent event propagation globaly, but i dont want this.

So, how can i prevent event propagation for custom event handlers.

Thanks.


Viewing all articles
Browse latest Browse all 46

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>