For example, there are several properties and a trailer that tracks a change in one of them, like this
Vue.component('Test', { props: { type: { type: String, default: 'one' }, items: { type: Array, default: function() { return []; } } }, watch: { items: function(newVal, oldVal) { console.log(newVal); console.log(oldVal); // this.type = 'two'; } Everything is good, everything works as it should. But if in this garden to change another property, the one that watches the changes in items will work twice. Those. if we track a change in one property and try to change another in it, then the tracked tracker will also work with what has been changed “inside”, something like that ...
Vue.component('Test', { props: { type: { type: String, default: 'one' }, items: { type: Array, default: function() { return []; } } }, watch: { items: function(newVal, oldVal) { console.log(newVal); // получили вывод в консоли два раза console.log(oldVal); // получили вывод в консоли два раза this.type = 'two'; // изменили свойство type } Why What am I doing wrong? How to do right?