0👍
beforeCreate is called before data observation. Try again using beforeMount
0👍
Simply in the beforeCreate
life cycle method your data
object not loaded yet so you can’t call it at this time so the best practice for this to use created
method
beforeCreate()
This is the very first lifecycle hook that gets called in Vue JS, it gets called immediately after the Vue instance has been initialized.
created()
the second lifecycle hook that is called right after the beforeCreated
hook. At this stage, the Vue instance has been initialized and has activated the start of things like computed properties, watchers, events, data properties and manipulations that come with it.
created: function(){
axios.post('')
.then(response => {
this.title = response.title
})
}
- [Vuejs]-When i get data with Axios my JS code doesn't works
- [Vuejs]-Get different between date in DOM
Source:stackexchange.com