Nuxt/test/fixtures/basic/pages/await-async-data.vue

19 lines
288 B
Vue
Raw Normal View History

2016-12-27 15:31:25 +00:00
<template>
<p>{{ name }}</p>
</template>
<script>
const fetchData = () => {
return new Promise(resolve => {
setTimeout(() => resolve({ name: 'Await Nuxt.js' }), 10)
})
}
export default {
2017-10-31 13:26:19 +00:00
async asyncData() {
const data = await fetchData()
return data
2016-12-27 15:31:25 +00:00
}
}
</script>