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");
}
})