[Vuejs]-How to get the component instance within an @click event?

0👍

I think the problem is the arrow function as commented

See an example here using function:

https://jsfiddle.net/rvp6fvwp/

Arrow function is bound to the parent context as said here https://v2.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.

Leave a comment