兄弟组件传值
需要一个utils文件夹的eventBus.js
import Vue from 'vue'
export default new Vue()
兄弟页面1兄弟页面2
在需要引入bus
在主页面引入兄弟页面们跟Bus
传值
Bus.$emit("brotherA", "李钢筋嘤嘤嘤");
接收值
bus.$on("brotherA", (val) => {
this.text = val;
});
记得销毁 不然会一直存在
destroyed(){
bus.$off()
}