Value passing problem of vue component

Child component A passes the value to the parent component by clicking the button event, and then passes the value from the parent component to child component B. Why does child component B receive the value only when the button is clicked for the first time, and then multiple button clicks do not work. If you refresh, you can only receive the value for the first time. The
code is as follows:

Sub-component A button Click to pass value event:

goIndex () {
this.$emit ("gogo","a");
}

parent component receiving code:
HTML:
< componentsA @ gogo = "button" > child component A < / componentsA >
< componentsB: child-tab = "isAddedTab" > child component B < / componentsB >
JS:
export default {

data () {
    return {
        isAddedTab:""
    }
},
components: {
    moneyDetails,
    settings
},
methods: {
   button(e){
        console.log(e);
        this.isAddedTab = e;
   }, 
}

}

subcomponent B received value:

props: ["childTab"],
watch: {

childTab(v){
 console.log(v);//vA
 }

},

May.07,2021

your $emit ('gogo','a') is a fixed value, and vue is responsive. If the isAddedTab value does not change, it will not be passed to component B

.

means that component B initially gets the isAddedTab value passed by the parent component is empty, because the default value of the parent component is empty, and then the A component button clicks, and the event is called back to the parent component, changing the isAddedTab value to a. At this time, because the isAddedTab changes, it is passed to the child component B to get the watch value a, and then you click the A component button twice, and the event will be triggered, but because the isAddedTab value is already a, the assignment is assigned to an again. The value will not be passed to component B repeatedly, because the value has not changed at all. Vue has been optimized here and will not pass the same value repeatedly

if you need component A to trigger certain actions every time component B clicks, then component An event triggers to the parent component. The parent component can directly call a method of child component B without prop.
if component A clicks to return a value to component B, you can write this now. When the value changes, component B will be notified. It's just that the value passed in your demo is the same every time. So only print once

Menu