mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
39 lines
665 B
Vue
39 lines
665 B
Vue
<script setup>
|
|
const { enabled: isPreview } = usePreviewMode()
|
|
|
|
const { data } = await useAsyncData(async () => {
|
|
await new Promise(resolve => setTimeout(resolve, 200))
|
|
|
|
const fetchedOnClient = process.client
|
|
|
|
console.log(fetchedOnClient)
|
|
|
|
return { fetchedOnClient }
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<NuxtLink
|
|
id="use-fetch-check"
|
|
href="/preview/with-use-fetch"
|
|
>
|
|
check useFetch
|
|
</NuxtLink>
|
|
|
|
<p
|
|
v-if="data && data.fetchedOnClient"
|
|
id="fetched-on-client"
|
|
>
|
|
fetched on client
|
|
</p>
|
|
|
|
<p
|
|
v-if="isPreview"
|
|
id="preview-mode"
|
|
>
|
|
preview mode enabled
|
|
</p>
|
|
</div>
|
|
</template>
|