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

13 lines
279 B
Vue
Raw Normal View History

<script nuxt setup lang="ts">
import { asyncData } from '@nuxt/app'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { data } = asyncData('time', () => $fetch('/api/count'))
</script>
<template>
<div>
Page visits: {{ data.count }}
</div>
</template>