Skip to content

Commit 876b677

Browse files
committed
fix: sidebarDepth doesn't work in i18n mode
1 parent ac9776d commit 876b677

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

packages/@vuepress/theme-default/components/SidebarLink.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ export default {
66
77
props: ['item'],
88
9-
render (h, { parent: { $page, $site, $route }, props: { item }}) {
9+
render (h,
10+
{
11+
parent: {
12+
$page,
13+
$site,
14+
$route,
15+
$themeConfig,
16+
$themeLocaleConfig
17+
},
18+
props: {
19+
item
20+
}
21+
}) {
1022
// use custom active class matching logic
1123
// due to edge case of paths ending with / + hash
1224
const selfActive = isActive($route, item.path)
@@ -18,9 +30,10 @@ export default {
1830
const link = renderLink(h, item.path, item.title || item.path, active)
1931
const configDepth = $page.frontmatter.sidebarDepth != null
2032
? $page.frontmatter.sidebarDepth
21-
: $site.themeConfig.sidebarDepth
33+
: ($themeLocaleConfig.sidebarDepth || $themeConfig.sidebarDepth)
2234
const maxDepth = configDepth == null ? 1 : configDepth
23-
const displayAllHeaders = !!$site.themeConfig.displayAllHeaders
35+
36+
const displayAllHeaders = !!$themeLocaleConfig.displayAllHeaders
2437
if (item.type === 'auto') {
2538
return [link, renderChildren(h, item.children, item.basePath, $route, maxDepth)]
2639
} else if ((active || displayAllHeaders) && item.headers && !hashRE.test(item.path)) {

0 commit comments

Comments
 (0)