pull/3621/merge
Shyam Chen 1 year ago committed by GitHub
commit 7d5f92ea6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -97,8 +97,8 @@ function onCaretClick() {
<div v-if="item.items && item.items.length" class="items">
<template v-if="depth < 5">
<VPSidebarItem
v-for="i in item.items"
:key="i.text"
v-for="(i, j) in item.items"
:key="`${depth}-${j}`"
:item="i"
:depth="depth + 1"
/>

@ -7,7 +7,6 @@ import {
ref,
watch,
watchEffect,
watchPostEffect,
type ComputedRef,
type Ref
} from 'vue'
@ -175,9 +174,15 @@ export function useSidebarControl(
collapsed.value = !!(collapsible.value && item.value.collapsed)
})
watchPostEffect(() => {
;(isActiveLink.value || hasActiveLink.value) && (collapsed.value = false)
})
watch(
item,
() => {
if (isActiveLink.value || hasActiveLink.value) {
collapsed.value = false
}
},
{ immediate: true, deep: true }
)
function toggle() {
if (collapsible.value) {

Loading…
Cancel
Save