diff --git a/src/layouts/components/SideNav.tsx b/src/layouts/components/SideNav.tsx index 4bc4941..4a806b8 100644 --- a/src/layouts/components/SideNav.tsx +++ b/src/layouts/components/SideNav.tsx @@ -15,6 +15,12 @@ const useComputed = (props) => { const active = computed(() => getActive()); + const defaultExpanded = computed(() => { + const path = getActive(); + const parentPath = path.substring(0, path.lastIndexOf('/')); + return parentPath === '' ? [] : [parentPath]; + }); + const sideNavCls = computed(() => { const { isCompact } = props; return [ @@ -44,6 +50,7 @@ const useComputed = (props) => { return { active, + defaultExpanded, collapsed, sideNavCls, menuCls, @@ -130,6 +137,7 @@ export default defineComponent({ class={this.menuCls} theme={this.theme} value={this.active} + default-expanded={this.defaultExpanded} collapsed={this.collapsed} v-slots={{ logo: () =>