feat: add doc before and after slot (#762) (#786)

close #762 

Co-authored-by: Kia Ishii <kia.king.08@gmail.com>
pull/791/head
Percy Ma 2 years ago committed by GitHub
parent 753f35bf7c
commit 9c2a36f542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -177,7 +177,7 @@ export default {
...DefaultTheme, ...DefaultTheme,
Layout() { Layout() {
return h(DefaultTheme.Layout, null, { return h(DefaultTheme.Layout, null, {
'sidebar-top': () => h(MyComponent) 'aside-outline-before': () => h(MyComponent)
}) })
} }
} }
@ -186,6 +186,8 @@ export default {
Full list of slots available in the default theme layout: Full list of slots available in the default theme layout:
- When `layout: 'doc'` (default) is enabled via frontmatter: - When `layout: 'doc'` (default) is enabled via frontmatter:
- `doc-before`
- `doc-after`
- `aside-top` - `aside-top`
- `aside-bottom` - `aside-bottom`
- `aside-outline-before` - `aside-outline-before`

@ -34,6 +34,9 @@ provide('close-sidebar', closeSidebar)
<template #home-features-before><slot name="home-features-before" /></template> <template #home-features-before><slot name="home-features-before" /></template>
<template #home-features-after><slot name="home-features-after" /></template> <template #home-features-after><slot name="home-features-after" /></template>
<template #doc-before><slot name="doc-before" /></template>
<template #doc-after><slot name="doc-after" /></template>
<template #aside-top><slot name="aside-top" /></template> <template #aside-top><slot name="aside-top" /></template>
<template #aside-bottom><slot name="aside-bottom" /></template> <template #aside-bottom><slot name="aside-bottom" /></template>
<template #aside-outline-before><slot name="aside-outline-before" /></template> <template #aside-outline-before><slot name="aside-outline-before" /></template>

@ -35,6 +35,9 @@ useCopyCode()
</VPHome> </VPHome>
<VPDoc v-else> <VPDoc v-else>
<template #doc-before><slot name="doc-before" /></template>
<template #doc-after><slot name="doc-after" /></template>
<template #aside-top><slot name="aside-top" /></template> <template #aside-top><slot name="aside-top" /></template>
<template #aside-outline-before><slot name="aside-outline-before" /></template> <template #aside-outline-before><slot name="aside-outline-before" /></template>
<template #aside-outline-after><slot name="aside-outline-after" /></template> <template #aside-outline-after><slot name="aside-outline-after" /></template>

@ -31,11 +31,15 @@ const pageName = path.replace(/[./]+/g, '_').replace(/_html$/, '')
<div class="content"> <div class="content">
<div class="content-container"> <div class="content-container">
<slot name="doc-before" />
<main class="main"> <main class="main">
<Content class="vp-doc" :class="pageName" /> <Content class="vp-doc" :class="pageName" />
</main> </main>
<VPDocFooter /> <VPDocFooter />
<slot name="doc-after" />
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save