Skip to content

Commit 3ab9fca

Browse files
authored
fix($default-theme): sidebar groups are not opened when directly navigating to these pages (fix#2564) (#2565)
1 parent e79c8b7 commit 3ab9fca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎packages/@vuepress/theme-default/components/SidebarLinks.vue‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ function resolveOpenGroupIndex (route, items){
9090
9191
functiondescendantIsActive (route, item){
9292
if (item.type==='group'){
93-
returnitem.children.some(child=>{
93+
constchildIsActive=item.path&&isActive(route, item.path)
94+
constgrandChildIsActive=item.children.some(child=>{
9495
if (child.type==='group'){
9596
returndescendantIsActive(route, child)
9697
} else{
9798
returnchild.type==='page'&&isActive(route, child.path)
9899
}
99100
})
101+
102+
return childIsActive || grandChildIsActive
100103
}
101104
returnfalse
102105
}

0 commit comments

Comments
(0)