0👍
✅
Guessing that the axios request is inside any lifecycle hook or any method…this
inside success callback does not point to the vue instance, that’s why you cannot mutate the data property.
Use an arrow function instead:
axios({
method: 'post',
url: 'http://localhost/test,
responseType: 'json',
data: {
data: this.test
}
}).then( (response) => {
this.test= response.data
}).catch( (error) => {
console.log(error)
});
Fat arrow functions =>
bind this
lexically, so you have this
pointing the vue instance
Source:stackexchange.com