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

13 lines
260 B
Vue
Raw Normal View History

2021-04-23 20:30:43 +00:00
<template>
<div>
{{ data }}
<button :disabled="pending" @click="refresh">
Refrash Data
</button>
2021-04-23 20:30:43 +00:00
</div>
</template>
<script setup>
const { data, refresh, pending } = await useAsyncData('/api/hello', () => $fetch('/api/hello'))
2021-04-23 20:30:43 +00:00
</script>