fix(sidebar): watch item deep

pull/3621/head
Shyam-Chen 2 years ago
parent 9a479f246e
commit 32f0943f0a

@ -7,7 +7,6 @@ import {
ref,
watch,
watchEffect,
watchPostEffect,
type ComputedRef,
type Ref
} from 'vue'
@ -176,9 +175,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