首先在main.js中
Vue.prototype.$eventBus = new Vue()
A組件中通過觸發事件或者其他什么,然后發射數據
this.$eventBus.$emit('key','data-1232131232132131232');
B組件中接收A組件的數據
this.$eventBus.$on('key',function(params){ console.log(params); // data-1232131232132131232 });