feat(layout): 调整侧边栏菜单过滤逻辑并优化布局结构
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 6m22s
CI/CD Pipeline / build-and-deploy (push) Successful in 6m31s

This commit is contained in:
严浩
2025-10-21 19:18:27 +08:00
parent 642cac1493
commit e54272b68b
5 changed files with 41 additions and 9 deletions

View File

@@ -15,8 +15,8 @@ function convertRoutesToMenuOptions(routes: RouteRecordNormalized[]): MenuOption
if (!route.name || route.meta?.hidden === true || route.meta?.layout === false) {
return false;
}
// 过滤掉根路径和通配符路径
if (route.path === '/' || route.path.includes('*')) {
// 过滤掉通配符路径
if (route.path.includes('*')) {
return false;
}
return true;
@@ -31,8 +31,8 @@ function convertRoutesToMenuOptions(routes: RouteRecordNormalized[]): MenuOption
key: route.path,
};
// 如果只有一级路径,直接添加到根菜单
if (pathSegments.length === 1) {
// 如果是根路径或只有一级路径,直接添加到根菜单
if (pathSegments.length === 0 || pathSegments.length === 1) {
rootMenus.push(menuOption);
menuMap.set(route.path, menuOption);
} else {

View File

@@ -18,11 +18,7 @@ const appStore = useAppStore();
</div>
</template>
<template #sider>
<div
class="bg-purple-100/28 dark:bg-purple-900/28 text-purple-900 dark:text-purple-100 h-full overflow-hidden"
>
<BaseLayoutSider />
</div>
<BaseLayoutSider />
</template>
<div class="bg-yellow-100/28 dark:bg-yellow-900/28 text-yellow-900 dark:text-yellow-100 p-4">
4#GlobalMenu

View File

@@ -0,0 +1,5 @@
<script setup lang="ts"></script>
<template>
<div>deep</div>
</template>

View File

@@ -0,0 +1,5 @@
<script setup lang="ts"></script>
<template>
<div>deep2</div>
</template>