0👍
I think that you should use the EventBus to solve your question.
in main.js
const bus = new Vue()
Vue.prototype.$bus = bus
you can register an event listener
this.$bus.on( 'test', ( data ) => {
console.log( 'test', data );
} );
and emit it
this.$bus.emit( 'test', { code: 1 } );
you also can look at https://github.com/yyued/hub.js
Source:stackexchange.com