| | |
| | | <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> |
| | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | import usePermissionStore from '@/store/modules/permission' |
| | | import {onMounted, ref} from "vue"; |
| | | import Cookies from "js-cookie"; |
| | | import menu from "./menu" |
| | | import {computed} from "vue"; |
| | | import {useRoute} from "vue-router"; |
| | | |
| | | const route = useRoute(); |
| | | const appStore = useAppStore() |
| | | const settingsStore = useSettingsStore() |
| | | const permissionStore = usePermissionStore() |
| | | // const sidebarRouters = computed(() => permissionStore.sidebarRouters); |
| | | const sidebarRouters = ref([]) |
| | | |
| | | onMounted(() => { |
| | | sidebarRouters.value = JSON.parse(Cookies.get('routers')) |
| | | }); |
| | | // const getMenu = () => { |
| | | // const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | // if(userInfo.identity === 0) { |
| | | // |
| | | // sidebarRouters.value = menu.adminMenu |
| | | // Cookies.set('routers',JSON.stringify(sidebarRouters.value)) |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | 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); |
| | |
| | | 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> |