提交 eb231bf0 编写于 作者: A Anton Wilhelm 提交者: Franck Abgrall

fix($theme-default): Expand nested sidebar groups (#1540)

上级 1ba06ae1
...@@ -77,10 +77,23 @@ export default { ...@@ -77,10 +77,23 @@ export default {
function resolveOpenGroupIndex (route, items) { function resolveOpenGroupIndex (route, items) {
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
const item = items[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 i
} }
} }
return -1 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> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册