| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <script setup>
- import Logo from '../Logo/index.vue'
- import { useSettingStore } from '@/store/settings.js'
- import { usePermissionStore } from '@/store/permission.js'
- import sideBarItem from './sideBarItem.vue'
- import { watchEffect } from 'vue'
- const route = useRoute()
- const router = useRouter()
- const { collapse } = storeToRefs(useSettingStore())
- const sidebarRouters = computed(() => usePermissionStore().sidebarRouters)
- const theme = computed(() => useSettingStore().theme)
- const activeMenu = computed(() => {
- const { meta, path } = route
- if (meta.activeMenu) {
- return meta.activeMenu
- }
- let dealPath= decodeURIComponent(path)
- if(dealPath.startsWith('/workflow')){
- dealPath = '/tjmchild'+dealPath
- return dealPath
- }
- return path
- })
- </script>
- <template>
- <div class="tjm_sidebar_container" :class="{ 'is-collapse': !collapse }">
- <Logo />
- <el-scrollbar style="height: calc(100% - 60px)">
- <el-menu
- :default-active="activeMenu"
- :collapse="collapse"
- background-color="#283a5e"
- text-color="#fff"
- :unique-opened="true"
- :active-text-color="theme"
- :collapse-transition="false"
- mode="vertical"
- >
- <sideBarItem
- v-for="(route, index) in sidebarRouters"
- :key="route.path + index"
- :item="route"
- />
- </el-menu>
- </el-scrollbar>
- </div>
- </template>
- <style lang="scss" scoped>
- @mixin active {
- // &:hover {
- // color: $base-color-white;
- // }
- // &.is-active {
- // color: $base-color-white;
- // background-color: var(--el-color-primary) !important;
- // }
- }
- .tjm_sidebar_container {
- position: fixed;
- top: 0;
- bottom: 0;
- left: 0;
- z-index: $base-z-index;
- // width: $base-sidebar-width;
- height: 100vh;
- box-shadow: 2px 0 6px rgb(0 21 41 / 35%);
- border-right: 1px solid #ccc;
- background: $base-sidebar-menu-background;
- transition: width $base-transition-time;
- &.is-collapse {
- width: $base-sidebar-width;
- border-right: 0;
- }
- :deep(.el-scrollbar__wrap) {
- overflow-x: hidden;
- .el-menu {
- border: 0;
- }
- .el-sub-menu.is-active > .el-sub-menu__title{
- color: #409EFF !important;
- }
- .el-menu-item,
- .el-submenu__title {
- height: $base-sidebar-menu-item-height;
- overflow: hidden;
- line-height: $base-sidebar-menu-item-height;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: middle;
- }
- .el-menu-item {
- @include active;
- }
- }
- }
- </style>
|