Please see this minimum example
export default {
data() {
return {
name: "Amy",
age: 18,
};
},
computed: {
combinedDataForWatching() {
return {
name: this.name,
age: this.age,
};
},
},
watch: {
combinedDataForWatching() {
console.log("Triggered!");
},
},
mounted() {
setTimeout(() => {
this.name = "Bob";
this.age = 20;
}, 1000);
},
};
The console will only log "Triggered!" once, why is this happening?
And how does Vue determine this batch update?