Transfer values between components at the same level of vue?

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

Mar.13,2021
What's wrong with

?


sendToken () should be written in methods


found the problem,

mounted(){
      //rm1
      var self=this;
      bug.$on("usertoken",function(token){
          self.token=token; 
          //console.log(self.token),
       })
}
The

value has been taken, but in

bug.$on("usertoken",function(token){
     self.token=token;
 })

cannot be taken out and cannot be assigned to the form,
in data. How to solve this problem?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5dd5a-446d9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5dd5a-446d9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?