main.js
Vue.prototype.$EventBus = new Vue()
this.$EventBus.$emit(“shijianmingcheng “,{a:1}
第一个参数:事件名称
第二个参数:需要传递的数据
this.$EventBus.$on(“shijianmingcheng “, record=>{ this.b=record.a}
第一个参数: 对应的事件名称
第二个参数:接收对应事件的参数
this.$EventBus.$off(“shijianmingcheng)
移除事件








网友评论