vue原型链挂载总线:
main.js文件夾中引用 Vue.prototype.bus = new Vue();

子组件触发方法:this.$bus.$emit("updateMessageCount")

子组件接受方法并调用:this.$bus.$on("updateMessageCount", this.getUnreadCount);

this.getUnreadCount是一个方法

VUE之兄弟组件  $emit和$on、$bus的用法

 

相关文章:

  • 2022-12-23
  • 2021-06-14
  • 2021-09-05
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案