0👍
It appears you aren’t binding to the context of the beforeCreate
method in your axios
promise functions.
By using the forward arrow function
to bind the context
of your component to the axios
promise function you will be able to update the component data object properly:
beforeCreate : function(){
axios.get('/')
.then((response) => {
this.results = response.data
console.log(this.results)
})
.catch((error) => {
console.log(error)
});
},
- [Vuejs]-Vuetify v-btn with external link and dynamic property
- [Vuejs]-Vue js application object syntax
Source:stackexchange.com