We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ba06ae commit eb231bfCopy full SHA for eb231bf
packages/@vuepress/theme-default/components/SidebarLinks.vue
@@ -77,10 +77,23 @@ export default {
77
function resolveOpenGroupIndex (route, items) {
78
for (let i = 0; i < items.length; i++) {
79
const item = items[i]
80
- if (item.type === 'group' && item.children.some(c => c.type === 'page' && isActive(route, c.path))) {
+ if (descendantIsActive(route, item)) {
81
return i
82
}
83
84
return -1
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
+}
99
</script>
0 commit comments