implements passing the rm2 value from the rm1 component to the rm2 component
event bus
bugevents.js
import Vue from "vue"
export default new Vue;
rm1.vue
<el-button type="text" @click="sendToken">
</el-button>
------------
import bug from "../../../../static/js/bugevents.js";
data(){
list: {
token:1
}
},
methods:{
sendToken(){
var token = this.list.token;
bug.$emit("usertoken",token)
}
}
rm2.vue
<el-input v-model="token"></el-input>
----------
import bug from "../../../../static/js/bugevents.js";
data(){
token:""
},
mounted(){
//rm1
var self=this;
bug.$on("usertoken",function(token){
self.token=token;//datatoken
})
}
Is a method error or a code error? I hope all the great gods will give me some advice