How to change the variable in the data from a mounted in the promise?

Hello, tell me why the hook is mounted or created from promise->then you can't change a variable in the data, example:

 return {
 foo: null
created(){ = "baR"
 this.$http.get("server.api").then( () => { = "baZ" 
 console.log( // -> "baR"

Even if you bandit context, the result is the same
March 23rd 20 at 19:02
0 answer

Find more questions by tags Vue.js