|
|
@ -6,7 +6,7 @@ import {
|
|
|
|
} from 'vitepress'
|
|
|
|
} from 'vitepress'
|
|
|
|
import { computed, h, FunctionalComponent, VNode } from 'vue'
|
|
|
|
import { computed, h, FunctionalComponent, VNode } from 'vue'
|
|
|
|
import { Header } from '../../../../types/shared'
|
|
|
|
import { Header } from '../../../../types/shared'
|
|
|
|
import { isActive, getPathDirName } from '../utils'
|
|
|
|
import { isActive, joinUrl, getPathDirName } from '../utils'
|
|
|
|
import { DefaultTheme } from '../config'
|
|
|
|
import { DefaultTheme } from '../config'
|
|
|
|
import { useActiveSidebarLinks } from '../composables/activeSidebarLink'
|
|
|
|
import { useActiveSidebarLinks } from '../composables/activeSidebarLink'
|
|
|
|
|
|
|
|
|
|
|
@ -21,7 +21,7 @@ const SideBarItem: FunctionalComponent<{
|
|
|
|
const pageData = usePageData()
|
|
|
|
const pageData = usePageData()
|
|
|
|
const siteData = useSiteData()
|
|
|
|
const siteData = useSiteData()
|
|
|
|
|
|
|
|
|
|
|
|
const link = `${siteData.value.base}${relLink || ''}`
|
|
|
|
const link = resolveLink(siteData.value.base, relLink || '')
|
|
|
|
const active = isActive(route, link)
|
|
|
|
const active = isActive(route, link)
|
|
|
|
const headers = pageData.value.headers
|
|
|
|
const headers = pageData.value.headers
|
|
|
|
|
|
|
|
|
|
|
@ -150,6 +150,10 @@ function resolveMultiSidebar(
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function resolveLink(base: string, path: string): string | undefined {
|
|
|
|
|
|
|
|
return path ? joinUrl(base, path || '') : undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function createLink(active: boolean, text: string, link?: string): VNode {
|
|
|
|
function createLink(active: boolean, text: string, link?: string): VNode {
|
|
|
|
const tag = link ? 'a' : 'p'
|
|
|
|
const tag = link ? 'a' : 'p'
|
|
|
|
|
|
|
|
|
|
|
|