Skip to content

Commit

Permalink
fix: Ensure parent node expands in Tab routing switch
Browse files Browse the repository at this point in the history
Co-authored-by: JuneOY <JuneOY@users.noreply.github.com>
  • Loading branch information
chansee97 and JuneOY committed May 8, 2024
1 parent 8ae6acd commit df6c8e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/layouts/components/sider/Menu.vue
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit df6c8e5

Please sign in to comment.