mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
46 lines
799 B
Vue
46 lines
799 B
Vue
|
<template>
|
||
|
<AppPage>
|
||
|
<PageContent :page="page" />
|
||
|
<template #prev-next>
|
||
|
<PagePrevNext :prev="prev" :next="next" />
|
||
|
</template>
|
||
|
</AppPage>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import {
|
||
|
defineComponent,
|
||
|
ref,
|
||
|
useContext,
|
||
|
useFetch
|
||
|
} from '@nuxtjs/composition-api'
|
||
|
export default defineComponent({
|
||
|
props: {
|
||
|
page: {
|
||
|
type: Object,
|
||
|
required: true
|
||
|
}
|
||
|
},
|
||
|
setup (props) {
|
||
|
const { $docus } = useContext()
|
||
|
const prev = ref(null)
|
||
|
const next = ref(null)
|
||
|
useFetch(async () => {
|
||
|
const [prevLink, nextLink] = await $docus.getPreviousAndNextLink(
|
||
|
props.page
|
||
|
)
|
||
|
prev.value = prevLink
|
||
|
next.value = nextLink
|
||
|
})
|
||
|
return {
|
||
|
prev,
|
||
|
next
|
||
|
}
|
||
|
},
|
||
|
templateOptions: {
|
||
|
aside: true,
|
||
|
fluid: false
|
||
|
}
|
||
|
})
|
||
|
</script>
|