| | |
| | | <div :class="{ 'has-logo': showLogo }" class="sidebar-container">
|
| | | <logo v-if="showLogo" :collapse="isCollapse" />
|
| | | <el-scrollbar wrap-class="scrollbar-wrapper">
|
| | | <el-menu :default-active="activeMenu" :collapse="isCollapse" :background-color="getMenuBackground"
|
| | | :text-color="getMenuTextColor" :unique-opened="true" :active-text-color="theme" :collapse-transition="false"
|
| | | mode="vertical" :class="sideTheme">
|
| | | <sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route"
|
| | | :base-path="route.path" />
|
| | | <el-menu |
| | | :default-active="activeMenu" |
| | | :collapse="isCollapse" |
| | | :background-color="getMenuBackground" |
| | | :text-color="getMenuTextColor" |
| | | :unique-opened="true" |
| | | :active-text-color="theme" |
| | | :collapse-transition="false" |
| | | mode="vertical" |
| | | :class="sideTheme" |
| | | > |
| | | <sidebar-item |
| | | v-for="(route, index) in sidebarRouters" |
| | | :key="route.path + index" |
| | | :item="route" |
| | | :base-path="route.path" |
| | | /> |
| | | </el-menu>
|
| | | </el-scrollbar>
|
| | | </div>
|
| | |
| | | const theme = computed(() => settingsStore.theme)
|
| | | const isCollapse = computed(() => !appStore.sidebar.opened)
|
| | |
|
| | | // 获取菜单背景色
|
| | | const getMenuBackground = computed(() => {
|
| | | if (settingsStore.isDark) {
|
| | | return 'var(--sidebar-bg)'
|
| | | }
|
| | | // 浅色主题时,直接用主题色
|
| | | return sideTheme.value === 'theme-dark' ? variables.menuBg : settingsStore.theme
|
| | | })
|
| | | const getMenuBackground = computed(() => 'var(--sidebar-bg)') |
| | |
|
| | | // 获取菜单文字颜色
|
| | | const getMenuTextColor = computed(() => {
|
| | | if (settingsStore.isDark) {
|
| | | return 'var(--sidebar-text)'
|