3๐
โ
I think the problem is in the arrow function =>
: it does not have its own bindings to this
or super
, and should not be used as methods (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions).
To bind this
to a method use function
long or short notation.
Long notation:
const app = new Vue({
el: '#providers',
data: {
providers: []
},
created: function () {
console.log(this);
},
})
Short notation:
const app = new Vue({
el: '#providers',
data: {
providers: []
},
created() {
console.log(this);
},
})
๐คKonstantin
Source:stackexchange.com