0👍
You have a scoping issue: this
within the callback does not refer to your Vue instance. That is because you are not using ES6 arrow function, i.e.:
this.$http.get('http://localhost:8080/api.js').then(response => {
this.list = response.data
});
…which means the outer this
is not passed in. You will have to proxy that yourself, i.e. var self = this
on the outside, and then use self.list = response.data
:
var self = this;
this.$http.get('http://localhost:8080/api.js').then(response => {
self.list = response.data
});
- [Vuejs]-Axios get request link error in url of a click event
- [Vuejs]-Vuejs onclick behaviour on template's component
Source:stackexchange.com