1👍
You can use the fetch API in the mounted property :
let app = new Vue({
el: '#app',
mounted: {
fetch('your json url', ...params)
.then(res => res.json())
.then(json => {
this.json = json
})
},
data: {
json: {}
}
})
- [Vuejs]-How do i dynamically generate vue components from wordpress custom fields
- [Vuejs]-Toggle MANY divs onclick in Vue without pre-declaring the variables
0👍
On created you can make an api call and on success of that api call you can set store information of the first item.
created () hook
Let me know if it works
Thanks 🙂
- [Vuejs]-Vuex state in Vue.js computed returning before initialised
- [Vuejs]-How to write PWA in Vue js?
Source:stackexchange.com