See https://vuejs.org/v2/guide/instance.html#Properties-and-Methods
Don’t use arrow functions on an instance property or callback (e.g. vm.$watch('a', newVal => this.myMethod()))
. As arrow functions are bound to the parent context, this
will not be the Vue instance as you’d expect and this.myMethod
will be undefined.
As the same limitation applies to watchers, you have to use something like this:
watch: {
query: function() {
return debounce(() => {
this.autocomplete();
},
200,
{
leading: false,
trailing: true
});
}
}