vue js 组件之间的通信,$emit $on
//注册一个空的实例,作为中转站。
// 注册一个空的 Vue 实例,作为 ‘中转站’
var eventBus = new Vue({});
//$.emit触发事件传值 $.on监听事件接受值
//eventBus就是中转站 $emit 和 $on 的第一个参数相对应的 就能进行通信。
eventBus.$emit('refreshView', this.xmlObj);
- 上一篇 »vue $emit抛出事件
- 下一篇 »Vue.js组件的通信之父组件向子父组件的通信