1.在main.js中引入中央事件
/ 引入$emit和 $on 中央时间总线 Vue.prototype.$eventBus = new New()
2.在父组件的事件中写入要触发的子组件的值
this.$eventBus.$emit("show",参数)
3.在子组件中写出
this.$eventBus.$on("show",res=>{ // 这里写入要触发的事 })
注意,父组件和子组件$emit和$on的"show"必须相同
原文:https://www.cnblogs.com/xiaoyiyiaixuexi/p/13177737.html