After the updated event of the Vue child component is triggered, why is the updated event of the parent component not triggered?

assume that the current subcomponent is just a button, and the data data of the subcomponent will be changed when the button is clicked.

Why does this trigger only the updated of the child component and not the updated of the parent component?

is there any way to capture this update of the child component in the parent component without modifying the child component ?

<div id="app">
  <abc></abc>
</div>
Vue.component("abc",{
    name:"abc",
    template:`<div @click="add()">{{hi.a}}</div>`,
    data(){
        return{
            hi:{a:"1"}
        }
    },
    methods:{
        add(){
            this.hi.a = this.hi.a + "1";
        }
    },
    updated(){
        console.log("com-updated");
    }
});

new Vue({
  el: "-sharpapp",
    updated(){
        console.log("updated");
    }
})


Mar.28,2021

the parent component can use emit and on to listen for the event occurrence of the child component, and the child component must trigger the event before the parent component can receive it.
subcomponents:

<div @click="add">{{hi.a}}</div>

methods: {
    add () {
       this.$emit('changeHi', this.hi.a) //changeHi'this.hi.a'
    }
}

parent component

<abc @changeHi="changeHi"></abc> //changeHi,changeHi

methods: {
    changeHi(a) { // a
        a = a + "1";
    }
}

of course, vuex can also be used for data transfer, but vuex is generally used for medium and large projects. For small projects, custom events can be used for parent-child component transfer. For data transfer of sibling components, you can use event bus or vue-event-proxy plug-ins

.

if you change the data of the child component, it will not trigger the hook of the parent component. Communication in Vue is one-way, and the parent component can transmit information to the child component through props , that is, the child component can know the state change of the parent component, while the parent component does not know the state change of the child component.
if you want the child component to send messages to the parent component, you can specify and trigger the ide/components-custom-events.html" rel=" nofollow noreferrer "> custom event by on and emit , or you can use vuex to do this.

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