首先在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 });

 

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案