YY 2 years ago
parent
commit
1cabac29b9
2 changed files with 8 additions and 16 deletions
  1. 4 12
      src/components/admin-frame/parts/Sidebar.vue
  2. 4 4
      src/layout/menu.ts

+ 4 - 12
src/components/admin-frame/parts/Sidebar.vue

@@ -6,11 +6,9 @@
         <el-col :span="24" class="one">
           <el-menu
             class="sidebar-el-menu"
-            :default-active="active"
+            :default-active="onRoutes"
             unique-opened
-            default-openeds
             router
-            :collapse="collapse"
             :background-color="styleInfo.backColor"
             :text-color="styleInfo.textColor"
             :active-text-color="styleInfo.activeColor"
@@ -66,19 +64,13 @@ import { useRoute } from 'vue-router'
 // import { RoleStore } from '@common/src/stores/admin/role' //模块
 // import type { IQueryResult } from '@/util/types.util'
 // const role = RoleStore()
-const useRoutes = useRoute()
+const route = useRoute()
+let onRoutes = route.path
 let user: Ref<any> = ref(store.state.user)
 const styleInfo: Ref<any> = ref(menuInfo.info)
 let collapse: Ref<any> = ref(false)
 let items: Ref<any> = ref(admin)
-// 选中
-const active: Ref<any> = ref('')
-onMounted(async () => {
-  onRoutes()
-})
-const onRoutes = () => {
-  active.value = useRoutes.path
-}
+onMounted(async () => {})
 
 const getMenu = async () => {}
 

+ 4 - 4
src/layout/menu.ts

@@ -1,7 +1,7 @@
 export const system = [{ icon: 'iconshouye', index: '/adminCenter/homeIndex', name: '系统首页' }]
 // 管理员
 export const admin = [
-  { icon: 'iconshouye', _id: '11111111111111', index: '/adminCenter/homeIndex', name: '系统首页' },
+  { icon: 'iconshouye', _id: '11111111111111', path: '/homeIndex', name: '系统首页' },
   // {
   //   icon: 'iconshouye',
   //   index: '2',
@@ -223,21 +223,21 @@ export const admin = [
       {
         _id: '00000000000002',
         icon: 'iconshouye',
-        index: '/system/power',
+        path: '/system/power',
         name: '角色设置',
         num: '101-1'
       },
       {
         _id: '00000000000003',
         icon: 'iconshouye',
-        index: '/system/dictionary',
+        path: '/system/dictionary',
         name: '字典表设置',
         num: '101-2'
       },
       {
         _id: '00000000000004',
         icon: 'iconshouye',
-        index: '/system/uppasswd',
+        path: '/system/uppasswd',
         name: '修改密码',
         num: '101-3'
       }