fix: `base` option not generating correct multi sidebar (#231) (#234)

pull/240/head
Kia King Ishii 4 years ago committed by GitHub
parent 6538c8e70a
commit a613df46e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -135,7 +135,9 @@ const showSidebar = computed(() => {
const { themeConfig } = siteRouteData.value const { themeConfig } = siteRouteData.value
return !isSideBarEmpty(getSideBarConfig(themeConfig.sidebar, route.path)) return !isSideBarEmpty(
getSideBarConfig(themeConfig.sidebar, route.data.relativePath)
)
}) })
const toggleSidebar = (to?: boolean) => { const toggleSidebar = (to?: boolean) => {

@ -18,7 +18,7 @@ export const SideBarLink: FunctionalComponent<{
const text = props.item.text const text = props.item.text
const link = resolveLink(site.value.base, props.item.link) const link = resolveLink(site.value.base, props.item.link)
const children = (props.item as DefaultTheme.SideBarGroup).children const children = (props.item as DefaultTheme.SideBarGroup).children
const active = isActive(route, link) const active = isActive(route, props.item.link)
const childItems = createChildren(active, children, headers) const childItems = createChildren(active, children, headers)
return h('li', { class: 'sidebar-link' }, [ return h('li', { class: 'sidebar-link' }, [

@ -11,7 +11,7 @@ export function useNavLink(item: Ref<DefaultTheme.NavItemWithLink>) {
const isExternal = isExternalCheck(item.value.link) const isExternal = isExternalCheck(item.value.link)
const props = computed(() => { const props = computed(() => {
const routePath = normalizePath(route.path) const routePath = normalizePath(`/${route.data.relativePath}`)
let active = false let active = false
if (item.value.activeMatch) { if (item.value.activeMatch) {

@ -30,7 +30,7 @@ export function useSideBar() {
// now, there's no sidebar setting at frontmatter; let's see the configs // now, there's no sidebar setting at frontmatter; let's see the configs
const themeSidebar = getSideBarConfig( const themeSidebar = getSideBarConfig(
site.value.themeConfig.sidebar, site.value.themeConfig.sidebar,
route.path route.data.relativePath
) )
if (themeSidebar === false) { if (themeSidebar === false) {

@ -22,7 +22,7 @@ export function isActive(route: Route, path?: string): boolean {
return false return false
} }
const routePath = normalize(route.path) const routePath = normalize(`/${route.data.relativePath}`)
const pagePath = normalize(path) const pagePath = normalize(path)
return routePath === pagePath return routePath === pagePath

Loading…
Cancel
Save