1👍
Vue lifecycle methods can be async. You can await your method like this:
Options API
async created() {
await this.useCoords()
}
Composition API
onBeforeMount(async () => {
await useCoords()
})
One note for composition api – there is no "created" hook, so I used onBeforeMount as an example instead. It’s a much wider topic than this question entails.
- [Vuejs]-Laravel blade soft-migrating to Vue.js – how to handle tags?
- [Vuejs]-Navigating vuejs SPA via routes that share component does not refresh component data as expected
Source:stackexchange.com