File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
packages/@vuepress/theme-default/components Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -77,10 +77,23 @@ export default {
77
77
function resolveOpenGroupIndex (route , items ) {
78
78
for (let i = 0 ; i < items .length ; i++ ) {
79
79
const item = items[i]
80
- if (item . type === ' group ' && item . children . some ( c => c . type === ' page ' && isActive ( route, c . path ) )) {
80
+ if (descendantIsActive ( route, item )) {
81
81
return i
82
82
}
83
83
}
84
84
return - 1
85
85
}
86
+
87
+ function descendantIsActive (route , item ) {
88
+ if (item .type === ' group' ) {
89
+ return item .children .some (child => {
90
+ if (child .type === ' group' ) {
91
+ return descendantIsActive (route, child)
92
+ } else {
93
+ return child .type === ' page' && isActive (route, child .path )
94
+ }
95
+ })
96
+ }
97
+ return false
98
+ }
86
99
</script >
You can’t perform that action at this time.
0 commit comments