Answer the question
In order to leave comments, you need to log in
How to change variable in data from mounted to promise?
Hello, tell me why in the mounted or created hook from promise->then it is not possible to change the variable in data, example:
data(){
return {
foo: null
}
},
created(){
this.foo = "baR"
this.$http.get("server.api").then( () => {
this.foo = "baZ"
})
console.log(this.foo) // -> "baR"
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question