From cc3e08bda13360c88b7189e8f8d043b60783c7fb Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Thu, 21 Nov 2024 16:46:32 +0800
Subject: [PATCH] 新增
---
src/layout/components/Sidebar/index.vue | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 9b14dfc..5acaeb5 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -3,20 +3,20 @@
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper">
<el-menu
- :default-active="activeMenu"
- :collapse="isCollapse"
- :background-color="sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
- :text-color="sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
- :unique-opened="true"
- :active-text-color="theme"
- :collapse-transition="false"
- mode="vertical"
+ :default-active="activeMenu"
+ :collapse="isCollapse"
+ :background-color="sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
+ :text-color="sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
+ :unique-opened="true"
+ :active-text-color="theme"
+ :collapse-transition="false"
+ mode="vertical"
>
<sidebar-item
- v-for="(route, index) in sidebarRouters"
- :key="route.path + index"
- :item="route"
- :base-path="route.path"
+ v-for="(route, index) in sidebarRouters"
+ :key="route.path + index"
+ :item="route"
+ :base-path="route.path"
/>
</el-menu>
</el-scrollbar>
@@ -30,6 +30,8 @@
import useAppStore from '@/store/modules/app'
import useSettingsStore from '@/store/modules/settings'
import usePermissionStore from '@/store/modules/permission'
+import {computed} from "vue";
+import {useRoute} from "vue-router";
const route = useRoute();
const appStore = useAppStore()
@@ -37,6 +39,7 @@
const permissionStore = usePermissionStore()
const sidebarRouters = computed(() => permissionStore.sidebarRouters);
+console.log(sidebarRouters.value,789)
const showLogo = computed(() => settingsStore.sidebarLogo);
const sideTheme = computed(() => settingsStore.sideTheme);
const theme = computed(() => settingsStore.theme);
@@ -48,7 +51,14 @@
if (meta.activeMenu) {
return meta.activeMenu;
}
- return path;
-})
+ const showRoute = sidebarRouters.value.filter(item => !item.hidden);
+ if(showRoute[0].path === '/'){
+ return '/' + showRoute[0].children[0].path
+ }else{
+ return showRoute[0].path + '/' + showRoute[0].children[0].path
+ }
+
+ // return path
+})
</script>
--
Gitblit v1.9.2