Nuxt/examples/async-data/pages/index.vue

18 lines
259 B
Vue
Raw Normal View History

2021-04-23 20:30:43 +00:00
<template>
<div>
Page visits: {{ data.count }}
</div>
</template>
<script lang="ts">
export default defineNuxtComponent({
setup () {
const { data } = asyncData('time', () => $fetch('/api/count'))
return {
data
}
}
})
</script>