Skip to content

Commit

Permalink
fix($theme-default): Expand nested sidebar groups (#1540)
Browse files Browse the repository at this point in the history
  • Loading branch information
timaschew authored and kefranabg committed Sep 12, 2019
1 parent 1ba06ae commit eb231bf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/@vuepress/theme-default/components/SidebarLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,23 @@ export default {
function resolveOpenGroupIndex (route, items) {
for (let i = 0; i < items.length; i++) {
const item = items[i]
if (item.type === 'group' && item.children.some(c => c.type === 'page' && isActive(route, c.path))) {
if (descendantIsActive(route, item)) {
return i
}
}
return -1
}
function descendantIsActive (route, item) {
if (item.type === 'group') {
return item.children.some(child => {
if (child.type === 'group') {
return descendantIsActive(route, child)
} else {
return child.type === 'page' && isActive(route, child.path)
}
})
}
return false
}
</script>

0 comments on commit eb231bf

Please sign in to comment.