Discussion icon indicating copy to clipboard operation
Discussion copied to clipboard

Passing events between sibling components

Open slickorange opened this issue 10 years ago • 3 comments

Hi,

While the docs are pretty clear on passing data with events between parent and child components I am unsure on how to pass it between "sibling" components.

Currently I am using $dispatch on the on child. I the dispatched event in the parent and then I $broadcast the event again and catch it by the other child... It feels like there should be a better way?

slickorange avatar Jun 13 '15 06:06 slickorange

In this case you should probably use an event bus that is outside of the component tree. You don't always have to rely on the propagation.

yyx990803 avatar Jun 22 '15 14:06 yyx990803

@yyx990803 The "event bus" you are referring to is VueX?

leapon avatar May 31 '16 13:05 leapon

@leapon https://github.com/vuejs/vue/issues/2873 seach for "Upgrade Tips"

yyx990803 avatar May 31 '16 13:05 yyx990803