[Vuejs]-Waiting for User Coordinates to use in Vue

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.

Leave a comment