fix: Ensure parent node expands in Tab routing switch

Co-authored-by: JuneOY <JuneOY@users.noreply.github.com>
This commit is contained in:
chansee97 2024-05-08 14:35:18 +08:00
parent 8ae6acd62d
commit df6c8e5aef

@ -1,13 +1,25 @@
<script setup lang="ts">
import type { MenuInst } from 'naive-ui'
import { useAppStore } from '@/store'
import { useRouteStore } from '@/store/route'
const route = useRoute()
const appStore = useAppStore()
const routesStore = useRouteStore()
const menuInstRef = ref<MenuInst | null>(null)
watch(
() => route.path,
() => {
menuInstRef.value?.showOption(routesStore.activeMenu as string)
},
{ immediate: true },
)
</script>
<template>
<n-menu
ref="menuInstRef"
:collapsed="appStore.collapsed"
:indent="20"
:collapsed-width="64"