mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
c1ddb359e3
Co-authored-by: Damian Głowala <damian.glowala.rebkow@gmail.com>
29 lines
586 B
Vue
29 lines
586 B
Vue
<template>
|
|
<div>
|
|
<div>immediate-remove-unmounted.vue</div>
|
|
<div id="immediate-data">
|
|
{{ data === null ? "null" : data }}
|
|
</div>
|
|
<button
|
|
id="execute-btn"
|
|
@click="execute"
|
|
>
|
|
execute
|
|
</button>
|
|
<NuxtLink
|
|
id="to-index"
|
|
to="/"
|
|
>
|
|
index
|
|
</NuxtLink>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const { data, execute } = await useAsyncData('immediateFalse', () => $fetch('/api/random'), { immediate: false })
|
|
|
|
if (data.value !== null) {
|
|
throw new Error('Initial data should be null: ' + data.value)
|
|
}
|
|
</script>
|