I've got an error when tried to declare a variable in the usual way like this:
Vue.directive('my-directive', {
varA: '',
inserted: function(el, binding, vnode){
this.varA = 'test'; // TypeError: Cannot set property
// 'varA ' of undefined
},
});
TypeError: Cannot set property 'varA ' of undefined
How do you declare variables in Vue directives?