I've got
<component-one></component-one> <component-two></component-two> <component-three></component-three> Component two contains component three.
Currently I emit an event in <component-one> that has to be caught in <component-three>.
In <component-one> I fire the event like this:
this.$bus.$emit('setSecondBanner', finalBanner); Then in <component-three> I catch it like this:
mounted() { this.$bus.$on('setSecondBanner', (banner) => { alert('Caught'); this.banner = banner; }); }, But the event is never caught!
I define the bus like this (in my core.js):
let eventBus = new Vue(); Object.defineProperties(Vue.prototype, { $bus: { get: () => { return eventBus; } } }); What could be wrong here? When I check vue-dev-tools I can see that the event has fired!