1、在main.js中引用传值中转站
Vue.prototype.$bus = new Vue();
2、 组件发送点击事件
showBtn() {
this.$bus.$emit("dataChild");
},
3、组件接受事件
created() {
this.$bus.$on("dataChild", () => {
this.formShow = !this.formShow;
});
}
Vue.prototype.$bus = new Vue();
showBtn() {
this.$bus.$emit("dataChild");
},
created() {
this.$bus.$on("dataChild", () => {
this.formShow = !this.formShow;
});
}