Nuxt/examples/composables/use-fetch/app.vue
Clément Ollivier 1a7b570c82
docs(examples): add examples to docs (#3966)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2022-03-30 17:59:28 +02:00

17 lines
390 B
Vue

<script setup>
const count = ref(1)
const { data } = await useFetch(() => `/api/hello/${count.value}`, { params: { token: 123 } })
</script>
<template>
<NuxtExampleLayout example="use-fetch">
<div>
Fetch result:
<pre class="text-left"><code>{{ data }}</code></pre>
<NButton @click="count++">
+
</NButton>
</div>
</NuxtExampleLayout>
</template>