The two brothers of vue passed the value. Why didn't it work when component a was clicked for the first time? Do you need to go to the b component and then return the a component to pass the value?

vue is passed by two brothers. Why didn"t it work when component a was clicked for the first time? Do you need to go to the b component and then return the a component to pass the value?

clipboard.png

onetwo

clipboard.png

I created a js file

   import Vue from "vue";  
   
   export default new Vue();  

in the one component

 <div>
A:

  <span>{{elementValue}}</span>
  <input type="button" value="" @click.stop.prevent="elementByValue($event)">
  </div>
  
   import Bus from "../assets/eventBus.js"
    elementByValue: function () {
    Bus.$emit("getTarget","123")
  }
  

in the two component

 import Bus from "../assets/eventBus.js"
 
  Bus.$on("getTarget", target => {  
            console.log(target);  
        }); 
   

the first click in the one component has no effect. You have to go to the two component and then return to the one component. How to solve this situation?

Mar.02,2021

write the one in the two component in your new Vue js

.
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-1b38312-2c0db.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-1b38312-2c0db.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?