vue原型链挂载总线:
main.js文件夾中引用 Vue.prototype.bus = new Vue();
子组件触发方法:this.$bus.$emit("updateMessageCount")
子组件接受方法并调用:this.$bus.$on("updateMessageCount", this.getUnreadCount);
this.getUnreadCount是一个方法
vue原型链挂载总线:
main.js文件夾中引用 Vue.prototype.bus = new Vue();
子组件触发方法:this.$bus.$emit("updateMessageCount")
子组件接受方法并调用:this.$bus.$on("updateMessageCount", this.getUnreadCount);
this.getUnreadCount是一个方法
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。