Nuxt/docs/components/templates/Example.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

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>