Skip to content

Commit 42f63a8

Browse files
committed
fix: renderChildren / sidebarDepth: 0
1 parent ac4acab commit 42f63a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/default-theme/SidebarLink.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export default {
1414
? selfActive || item.children.some(c => isActive($route, item.basePath + '#' + c.slug))
1515
: selfActive
1616
const link = renderLink(h, item.path, item.title || item.path, active)
17-
const configDepth = $page.frontmatter.sidebarDepth || $site.themeConfig.sidebarDepth
17+
const configDepth = $page.frontmatter.sidebarDepth != null
18+
? $page.frontmatter.sidebarDepth
19+
: $site.themeConfig.sidebarDepth
1820
const maxDepth = configDepth == null ? 1 : configDepth
1921
if (item.type === 'auto') {
2022
return [link, renderChildren(h, item.children, item.basePath, $route, maxDepth)]
@@ -47,7 +49,7 @@ function renderChildren (h, children, path, route, maxDepth, depth = 1) {
4749
const active = isActive(route, path + '#' + c.slug)
4850
return h('li', { class: 'sidebar-sub-header' }, [
4951
renderLink(h, '#' + c.slug, c.title, active),
50-
...renderChildren(h, c.children, path, route, maxDepth, depth + 1)
52+
renderChildren(h, c.children, path, route, maxDepth, depth + 1)
5153
])
5254
}))
5355
}

0 commit comments

Comments
 (0)