0👍
axios.get()
returns a Promise
, sou you should console.log()
it after assignment, when Promise
is resolved. Till Promise
is not resolved value will still the same.
export default {
data() {
return {
myData: "foo"
}
},
beforeMount() {
axios.get("/api/data").then(response => {
this.rowData = response.data;
this.myData = this.rowData;
console.log(this.myData)
});
}
}
Source:stackexchange.com