0👍
✅
The problem is that your event is emitted on the bus before your page2/component
is created/mounted. I.e. your page2/component
doesn’t exist yet when the event is fired and subscribes to the event only after it has already been emitted. (EventBus doesn’t cache and propagate events to later subscribers)
You should instead listen for the event in a higher level component and then pass it to your page2 component as a prop or use a state store (vuex) to pass data/state between your components.
0👍
1 – First create a file eventbus.js and add code inside
import Vue from 'vue';
const EventBus = new Vue();
export default EventBus;
2- page1/component1
import EventBus from './event-bus';
and use it like this
EventBus.$emit('EVENT_NAME', payLoad);
Hope its helps
Source:stackexchange.com