I have use case where I can't move on and I will appreciate your help. In my vue component I have watcher for model "foo"'s properties aaaand bbb like this:
watch: {
'foo.aaa': function () {
this.foo.bbb = null;
this.callRest();
},
'foo.bbb': function () {
this.callRest();
},
}
there are multiple select inputs and select with model foo.bbb depends on select with model foo.aaa so I need set bbb to null when aaa changed.
Now I need solve case where I modify foo object and set its properties from mixin's created method. In that case when I change it from mixin I need ignore watcher's because it always null bbb property. Can you tell me how to solve it? Thank you.
How about using oldVal to determine whether the watcher is in the first specific initialization or not. Maybe it will look like this...
'foo.aaa': function (newVal, oldVal) {
if(oldVal) {
// not in first specific initialization
this.foo.bbb = null;
this.callRest();
} else {
// in first specific initialization
}
},
Hopefully, I don't misunderstood your question.