Nuxt/test/fixtures/basic/pages/useAsyncData/shared.vue

38 lines
855 B
Vue
Raw Normal View History

2023-10-27 22:21:20 +00:00
<script setup lang="ts">
import { useSharedAsyncData } from '../../composables/asyncDataTests'
import ComponentWithSharedUseAsyncData from '../../components/ComponentWithSharedUseAsyncData.vue'
const { data, pending, execute } = useSharedAsyncData()
const router = useRouter()
const page = ref(1)
const changeQuery = () => {
page.value += 1
router.push({
query: {
page: page.value
}
})
}
</script>
<template>
<div>
<div id="pageWithSharedAsyncData__execute" @click="() => execute()">
execute
</div>
<div id="pageWithSharedAsyncData__changeQuery" @click="changeQuery">
changeQuery
</div>
<div id="pageWithSharedAsyncData__data">
{{ data }}
</div>
<div id="pageWithSharedAsyncData__pending">
{{ pending }}
</div>
<ComponentWithSharedUseAsyncData />
</div>
</template>