Nuxt/test/fixtures/basic/pages/await-async-data.vue
2020-11-30 23:44:04 +01:00

19 lines
288 B
Vue

<template>
<p>{{ name }}</p>
</template>
<script>
const fetchData = () => {
return new Promise((resolve) => {
setTimeout(() => resolve({ name: 'Await Nuxt' }), 10)
})
}
export default {
async asyncData () {
const data = await fetchData()
return data
}
}
</script>