zhitan-vue/src/assets/styles/sidebar.scss | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/layout/components/Sidebar/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/layout/components/TagsView/ScrollPane.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/layout/components/TagsView/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/layout/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-vue/src/store/modules/permission.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
zhitan-vue/src/assets/styles/sidebar.scss
@@ -13,6 +13,7 @@ .main-container { background-color: #110f2e !important; height: 100%; transition: margin-left 0.28s; margin-left: $base-sidebar-width; @@ -28,7 +29,7 @@ transition: width 0.28s; width: $base-sidebar-width !important; background-color: $base-menu-background; height: 100%; height: calc(100% - 60px) !important; position: fixed; top: 60px; bottom: 0; @@ -321,7 +322,7 @@ transition: width 0.28s; width: $base-sidebar-width !important; background-color: $base-menu-background; height: 100%; height: calc(100% - 60px) !important; position: fixed; top: 60px; bottom: 0; zhitan-vue/src/layout/components/Sidebar/index.vue
@@ -5,9 +5,8 @@ class="sidebar-container-wrapper" > <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper" view-class="scrollbar-view"> <!-- 首页时不显示任何菜单项 --> <!-- 始终显示菜单项,不再根据路径判断 --> <el-menu v-if="!isHomePage" :default-active="activeMenu" :collapse="isCollapse" :background-color="'transparent'" @@ -18,15 +17,24 @@ mode="vertical" class="custom-menu" > <sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" /> <!-- 当前是首页看板子路由时,渲染专用路由 --> <template v-if="isIndexSubRoute"> <sidebar-item v-for="(route, index) in indexPageRouters" :key="route.path + index" :item="route" :base-path="route.path" /> </template> <template v-else> <sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" /> </template> </el-menu> <!-- 首页时的空白区域 --> <div v-else class="home-empty-menu"></div> </el-scrollbar> <!-- 底部用户区域 --> @@ -95,19 +103,21 @@ const sidebarRouters = computed(() => permissionStore.sidebarRouters) // 判断当前是否为首页 const isHomePage = computed(() => { return route.path === '/index' || route.path === '/' || route.fullPath.startsWith('/index') // 判断当前是否为首页子路由(/index/index) const isIndexSubRoute = computed(() => { return route.path === '/index/index' }) // 首页专用路由,只有首页一个菜单项 const homePageRouters = computed(() => { // 从原始路由中筛选出首页路由 const homeRoute = sidebarRouters.value.find(route => { return route.children && route.children.find(child => child.path === '/index') }) return homeRoute ? [homeRoute] : [] // 判断当前是否为主首页路由(/index或/) const isMainIndexRoute = computed(() => { return route.path === '/index' || route.path === '/' }) // 首页专用路由,首页看板相关菜单 const indexPageRouters = computed(() => { // 查找name为Index的路由 const indexRoute = sidebarRouters.value.find(route => route.name === 'Index') return indexRoute ? [indexRoute] : [] }) const showLogo = computed(() => settingsStore.sidebarLogo) zhitan-vue/src/layout/components/TagsView/ScrollPane.vue
@@ -99,7 +99,7 @@ bottom: 0px; } :deep(.el-scrollbar__wrap) { height: 39px; height: 40px !important; } } </style> zhitan-vue/src/layout/components/TagsView/index.vue
@@ -234,7 +234,7 @@ <style lang="scss" scoped> .themeDark { .tags-view-container { height: 52px; height: 40px; width: 100%; background: #1a235d; // border-bottom: 1px solid #d8dce5; zhitan-vue/src/layout/index.vue
@@ -134,10 +134,11 @@ // 组件挂载时,确保首页侧边栏状态正确 onMounted(() => { // 如果当前是首页,确保侧边栏可见 // 如果当前是首页子页面,只确保侧边栏不被隐藏,但保持折叠/展开状态不变 if (route.path === '/index/index') { // 只设置不隐藏侧边栏,但不改变其展开/折叠状态 appStore.toggleSideBarHide(false) appStore.sidebar.opened = true // 不再强制设置opened为true,保持用户之前的设置 } }) zhitan-vue/src/store/modules/permission.js
@@ -58,6 +58,20 @@ // 遍历后台传来的路由字符串,转换为组件对象 function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false, parentRoute = null) { return asyncRouterMap.filter(route => { // 不再过滤掉首页看板相关路由 /* // 过滤掉首页看板相关路由 if (route.name === 'Index' && route.meta && route.meta.title === '首页看板') { return false; } // 如果是首页看板的子菜单,也过滤掉 if (route.path === '/index' || route.path === 'index' || (route.meta && route.meta.title === '首页看板')) { return false; } */ // 设置父路由引用 if (parentRoute) { route.parent = parentRoute;