feat(sidebar): use base when creating link (#74)

pull/77/head
Carlos Rodrigues 4 years ago committed by GitHub
parent 092ee772da
commit 79bc9fb15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,9 @@
import { usePageData, useRoute, useSiteDataByRoute } from 'vitepress'
import {
usePageData,
useRoute,
useSiteDataByRoute,
useSiteData
} from 'vitepress'
import { computed, h, FunctionalComponent, VNode } from 'vue'
import { Header } from '../../../../types/shared'
import { isActive, getPathDirName } from '../utils'
@ -9,12 +14,14 @@ const SideBarItem: FunctionalComponent<{
item: ResolvedSidebarItem
}> = (props) => {
const {
item: { link, text, children }
item: { link: relLink, text, children }
} = props
const route = useRoute()
const pageData = usePageData()
const siteData = useSiteData()
const link = `${siteData.value.base}${relLink || ''}`
const active = isActive(route, link)
const headers = pageData.value.headers

Loading…
Cancel
Save