Skip to content

Commit

Permalink
feat(sidebar): use base when creating link (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
pikax committed Sep 3, 2020
1 parent 092ee77 commit 79bc9fb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/client/theme-default/components/SideBar.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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

Expand Down

0 comments on commit 79bc9fb

Please sign in to comment.