The reason that you can’t execute the following code
watch: {
a: (val, oldVal) => {
this.executeMyMethod()
}
}
is because arrow functions bind to the parent context, so ‘this’ will not be the vue context as you expect, this.executeMyMethod will be undefined.
This is how your code should look like:
watch: {
a: function(val, oldVal){
this.executeMyMethod()
}
}
Enjoy!