Skip to content

Commit

Permalink
fix: renderChildren / sidebarDepth: 0
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 15, 2018
1 parent ac4acab commit 42f63a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/default-theme/SidebarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default {
? selfActive || item.children.some(c => isActive($route, item.basePath + '#' + c.slug))
: selfActive
const link = renderLink(h, item.path, item.title || item.path, active)
const configDepth = $page.frontmatter.sidebarDepth || $site.themeConfig.sidebarDepth
const configDepth = $page.frontmatter.sidebarDepth != null
? $page.frontmatter.sidebarDepth
: $site.themeConfig.sidebarDepth
const maxDepth = configDepth == null ? 1 : configDepth
if (item.type === 'auto') {
return [link, renderChildren(h, item.children, item.basePath, $route, maxDepth)]
Expand Down Expand Up @@ -47,7 +49,7 @@ function renderChildren (h, children, path, route, maxDepth, depth = 1) {
const active = isActive(route, path + '#' + c.slug)
return h('li', { class: 'sidebar-sub-header' }, [
renderLink(h, '#' + c.slug, c.title, active),
...renderChildren(h, c.children, path, route, maxDepth, depth + 1)
renderChildren(h, c.children, path, route, maxDepth, depth + 1)
])
}))
}
Expand Down

1 comment on commit 42f63a8

@jackmahoney
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love Vuepress but we probably need more integration tests

Please sign in to comment.