Nuxt/test/fixtures/basic/pages/await-async-data.vue
2017-10-31 14:26:19 +01:00

19 lines
288 B
Vue

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