fix: 修复文件系统路由下,次导航无法按层级依次展开

This commit is contained in:
hooray
2022-11-19 09:11:03 +08:00
parent b2e33ca05f
commit f0a523f505
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts" setup name="SidebarItem">
// import SidebarItem from './index.vue'
import { isExternalLink, resolveRoutePath } from '@/utils'
import useSettingsStore from '@/store/modules/settings'
import type { Menu } from '@/global'
const props = defineProps({
@@ -14,6 +15,8 @@ const props = defineProps({
},
})
const settingsStore = useSettingsStore()
const hasChildren = computed(() => {
let flag = true
if (props.item.children) {
@@ -40,7 +43,7 @@ const hasChildren = computed(() => {
</el-menu-item>
</a>
</router-link>
<el-sub-menu v-else :title="item.meta.title" :index="resolveRoutePath(basePath, item.path || '')">
<el-sub-menu v-else :title="item.meta.title" :index="settingsStore.app.routeBaseOn !== 'filesystem' ? resolveRoutePath(basePath, item.path || '') : JSON.stringify(item)">
<template #title>
<el-icon v-if="item.meta.icon" class="title-icon">
<svg-icon :name="item.meta.icon" />
+1 -1
View File
@@ -3,7 +3,7 @@ import type { Menu } from '@/global'
const menus: Menu.recordRaw = {
meta: {
title: '多级导航',
icon: 'heroicons-solid:menu-alt-3',
icon: 'sidebar-menu',
},
children: [
{