Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Access data out of Axios .then vue.js

data() {
	return {
    	variable: null
    }
}

mounted() {
    axios.get(url)
     .then(function (response) {
        this.variable = response.data
     }.bind(this)) //You need to put .bind(this) to keep the scoped variable
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Access #data #Axios
ADD COMMENT
Topic
Name
6+2 =