feat(layout): 调整侧边栏菜单过滤逻辑并优化布局结构
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
5
src/pages/page/deep/deep.page.vue
Normal file
5
src/pages/page/deep/deep.page.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>deep</div>
|
||||
</template>
|
||||
5
src/pages/page/deep/deep2.page.vue
Normal file
5
src/pages/page/deep/deep2.page.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>deep2</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user