feat(theme): add option for enable prevPage/nextPage, close #132
This commit is contained in:
parent
bf4b8dcb06
commit
8fa9ec0b4a
@ -11,13 +11,16 @@ import { useBlogPageData } from './page.js'
|
||||
|
||||
export function usePrevNext() {
|
||||
const route = useRoute()
|
||||
const { frontmatter } = useData()
|
||||
const { frontmatter, theme } = useData()
|
||||
const { sidebar } = useSidebar()
|
||||
const postList = usePostList() as unknown as Ref<PlumeThemeBlogPostItem[]>
|
||||
const locale = usePageLang()
|
||||
const { isBlogPost } = useBlogPageData()
|
||||
|
||||
const prevNavList = computed(() => {
|
||||
if (theme.value.prevPage === false)
|
||||
return null
|
||||
|
||||
const prevConfig = resolveFromFrontmatterConfig(frontmatter.value.prev)
|
||||
if (prevConfig !== false)
|
||||
return prevConfig
|
||||
@ -35,6 +38,9 @@ export function usePrevNext() {
|
||||
})
|
||||
|
||||
const nextNavList = computed(() => {
|
||||
if (theme.value.nextPage === false)
|
||||
return null
|
||||
|
||||
const nextConfig = resolveFromFrontmatterConfig(frontmatter.value.next)
|
||||
if (nextConfig !== false)
|
||||
return nextConfig
|
||||
|
||||
@ -26,6 +26,8 @@ const FALLBACK_OPTIONS: PlumeThemeLocaleData = {
|
||||
// page meta
|
||||
editLink: true,
|
||||
contributors: true,
|
||||
prevPage: true,
|
||||
nextPage: true,
|
||||
|
||||
footer: {
|
||||
message:
|
||||
|
||||
@ -211,6 +211,13 @@ export interface PlumeThemeLocaleData extends LocaleData {
|
||||
*/
|
||||
outlineLabel?: string
|
||||
|
||||
/**
|
||||
* 是否显示上一页
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
prevPage?: boolean
|
||||
|
||||
/**
|
||||
* 上一页的文本
|
||||
*
|
||||
@ -218,6 +225,13 @@ export interface PlumeThemeLocaleData extends LocaleData {
|
||||
*/
|
||||
prevPageLabel?: string
|
||||
|
||||
/**
|
||||
* 是否显示下一页
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
nextPage?: boolean
|
||||
|
||||
/**
|
||||
* 下一页的文本
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user