mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
8dd77d7b6e
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com> Co-authored-by: Pooya Parsa <pyapar@gmail.com>
20 lines
443 B
Vue
20 lines
443 B
Vue
<script setup>
|
|
const ctr = ref(0)
|
|
const { data, pending, refresh } = await useAsyncData('/api/hello', () => $fetch(`/api/hello/${ctr.value}`), { watch: [ctr] })
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
{{ data }}
|
|
<div class="flex justify-center gap-2">
|
|
<NButton :disabled="pending" @click="ctr++">
|
|
+
|
|
</NButton>
|
|
<NButton :disabled="pending" @click="refresh">
|
|
⟳
|
|
</NButton>
|
|
</div>
|
|
</div>
|
|
</template>
|