- 首页要创建一个js的文件;我将其命名为bug.js
import Vue from 'vue'
export default new Vue()
- 要操作使用的页面中,直接是
引入bus文件:import bus from "@/utils/bus.js"
使用方法:
bus.$emit( 'updateKeyWords' , this.keywords);
- 接受的页面可以直接在mounted中接受
mounted(){
let _this=this;
bus.$on('updateKeyWords', function(val) {
_this.keyWords=val
_this.dialogVisible=true;
_this.getverifyPic();
})
},
网友评论