From 288ad5be2d5149897da92a7bdfdcf8a688b889ef Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 19 五月 2026 11:38:03 +0800
Subject: [PATCH] 进销存pro 1.部署修改
---
src/layout/components/Sidebar/index.vue | 299 ++++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 182 insertions(+), 117 deletions(-)
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 83d3026..5e3b79b 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -1,142 +1,207 @@
<template>
- <div :class="{ 'has-logo': showLogo }" class="sidebar-container">
- <logo v-if="showLogo" :collapse="isCollapse" />
+ <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>
</template>
<script setup>
-import Logo from './Logo'
-import SidebarItem from './SidebarItem'
-import variables from '@/assets/styles/variables.module.scss'
-import useAppStore from '@/store/modules/app'
-import useSettingsStore from '@/store/modules/settings'
-import usePermissionStore from '@/store/modules/permission'
+ import Logo from "./Logo";
+ import SidebarItem from "./SidebarItem";
+ import variables from "@/assets/styles/variables.module.scss";
+ import useAppStore from "@/store/modules/app";
+ import useSettingsStore from "@/store/modules/settings";
+ import usePermissionStore from "@/store/modules/permission";
-const route = useRoute()
-const appStore = useAppStore()
-const settingsStore = useSettingsStore()
-const permissionStore = usePermissionStore()
+ const route = useRoute();
+ const appStore = useAppStore();
+ const settingsStore = useSettingsStore();
+ const permissionStore = usePermissionStore();
-const sidebarRouters = computed(() => permissionStore.sidebarRouters)
-const showLogo = computed(() => settingsStore.sidebarLogo)
-const sideTheme = computed(() => settingsStore.sideTheme)
-const theme = computed(() => settingsStore.theme)
-const isCollapse = computed(() => !appStore.sidebar.opened)
+ const sidebarRouters = computed(() => permissionStore.sidebarRouters);
+ const showLogo = computed(() => settingsStore.sidebarLogo);
+ const sideTheme = computed(() => settingsStore.sideTheme);
+ const theme = computed(() => settingsStore.theme);
+ const isCollapse = computed(() => !appStore.sidebar.opened);
-const getMenuBackground = computed(() => 'var(--sidebar-bg)')
+ const getMenuBackground = computed(() => "var(--sidebar-bg)");
-const getMenuTextColor = computed(() => {
- if (settingsStore.isDark) {
- return 'var(--sidebar-text)'
- }
- return sideTheme.value === 'theme-dark' ? variables.menuText : variables.menuLightText
-})
+ const getMenuTextColor = computed(() => {
+ if (settingsStore.isDark) {
+ return "var(--sidebar-text)";
+ }
+ return sideTheme.value === "theme-dark"
+ ? variables.menuText
+ : variables.menuLightText;
+ });
-const activeMenu = computed(() => {
- const { meta, path } = route
- if (meta.activeMenu) {
- return meta.activeMenu
- }
- return path
-})
+ const activeMenu = computed(() => {
+ const { meta, path } = route;
+ if (meta.activeMenu) {
+ return meta.activeMenu;
+ }
+ return path;
+ });
</script>
<style lang="scss" scoped>
-.sidebar-container {
- background-color: v-bind(getMenuBackground);
- border-radius: 22px;
- overflow: hidden;
-
- .scrollbar-wrapper {
+ .sidebar-container {
background-color: v-bind(getMenuBackground);
- }
+ border-radius: var(--radius-lg);
+ overflow: hidden;
- .el-menu {
- border: none;
- height: 100%;
- width: 100% !important;
- border-radius: 22px;
-
- .el-menu-item,
- .el-sub-menu__title {
- margin-bottom: 6px;
- border-radius: 14px;
- color: v-bind(getMenuTextColor);
-
- &:hover {
- background-color: var(--menu-hover, rgba(0, 0, 0, 0.06)) !important;
- border-radius: 14px;
- }
+ .scrollbar-wrapper {
+ background-color: v-bind(getMenuBackground);
}
- .el-menu-item {
- &.is-active {
- color: v-bind(theme);
- background-color: var(--menu-active-bg, rgba(0, 0, 0, 0.06)) !important;
+ .el-menu {
+ border: 1px solid var(--surface-border) !important;
+ height: 100%;
+ width: 100% !important;
+ border-radius: var(--radius-lg);
+
+ .el-menu-item,
+ .el-sub-menu__title {
+ margin-bottom: 5px;
+ border-radius: var(--radius-xs);
+ color: v-bind(getMenuTextColor);
+ font-size: 13.5px;
+ letter-spacing: 0.2px;
+ transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
+ border: none !important;
+
+ &:hover {
+ background-color: var(--menu-hover) !important;
+ border-radius: var(--radius-sm);
+ transform: translateX(2px);
+ }
+
+ .svg-icon {
+ transition: all 0.25s ease;
+ }
+
+ &:hover .svg-icon {
+ transform: scale(1.1);
+ color: var(--el-color-primary, var(--accent-primary));
+ }
+ }
+
+ .el-menu-item {
+ color: var(--sidebar-text);
+
+ &.is-active {
+ background: var(--menu-active-bg) !important;
+ color: var(--menu-active-text) !important;
+ font-weight: 500;
+ border-radius: var(--radius-sm);
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+
+ .svg-icon {
+ color: var(--menu-active-text) !important;
+ }
+ }
+ }
+
+ .el-sub-menu__title {
+ color: v-bind(getMenuTextColor);
+ }
+
+ :deep(.el-sub-menu__icon-arrow) {
+ display: inline-flex !important;
+ align-items: center;
+ justify-content: center;
+ width: 14px;
+ height: 14px;
+ margin-top: -7px;
+ right: 12px;
+ font-size: 14px !important;
+ color: currentColor !important;
+ opacity: 0.7;
+ transition: all 0.25s ease;
+ }
+
+ :deep(.el-sub-menu.is-opened .el-sub-menu__icon-arrow) {
+ transform: rotate(180deg);
+ }
+
+ :deep(.el-sub-menu.is-active > .el-sub-menu__title) {
+ color: var(--menu-active-text) !important;
font-weight: 600;
+ border-radius: var(--radius-sm);
+ margin: 0 10px 5px !important;
+ padding-left: 10px !important;
+ padding-right: 10px !important;
+ box-sizing: border-box;
+ overflow: hidden;
+ background-clip: padding-box;
+ background: var(--menu-active-bg) !important;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+ border: none !important;
+ }
+
+ :deep(.el-menu-item.is-active) {
+ margin: 0 10px 5px !important;
+ width: calc(100% - 20px) !important;
+ padding-left: 10px !important;
+ padding-right: 10px !important;
+ box-sizing: border-box;
+ overflow: hidden;
+ background-clip: padding-box;
+ border-radius: var(--radius-sm);
+ }
+
+ :deep(.el-sub-menu.is-active > .el-sub-menu__title .menu-title),
+ :deep(.el-sub-menu.is-active > .el-sub-menu__title .svg-icon) {
+ color: var(--menu-active-text) !important;
+ }
+
+ :deep(.el-menu-item.is-active .menu-title) {
+ color: var(--menu-active-text) !important;
+ }
+
+ :deep(.el-sub-menu__title:hover),
+ :deep(.el-menu-item:hover) {
+ border-radius: var(--radius-sm);
+ }
+
+ // 瀛愯彍鍗曞睍寮�鍔ㄧ敾浼樺寲
+ :deep(.el-sub-menu .el-menu) {
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+ }
+
+ // 鑿滃崟椤硅繘鍏ュ姩鐢�
+ :deep(.el-menu-item),
+ :deep(.el-sub-menu__title) {
+ animation: menuItemFadeIn 0.3s ease forwards;
+ }
+
+ @keyframes menuItemFadeIn {
+ from {
+ opacity: 0;
+ transform: translateX(-8px);
+ }
+ to {
+ opacity: 1;
+ transform: translateX(0);
+ }
}
}
-
- .el-sub-menu__title {
- color: v-bind(getMenuTextColor);
- }
-
- :deep(.el-sub-menu.is-active > .el-sub-menu__title) {
- color: v-bind(theme) !important;
- font-weight: 600;
- background-color: var(--menu-active-bg, rgba(0, 0, 0, 0.06)) !important;
- border-radius: 14px;
- margin: 0 10px 6px !important;
- width: calc(100% - 20px) !important;
- padding-left: 10px !important;
- padding-right: 10px !important;
- box-sizing: border-box;
- overflow: hidden;
- background-clip: padding-box;
- }
-
- :deep(.el-menu-item.is-active) {
- margin: 0 10px 6px !important;
- width: calc(100% - 20px) !important;
- padding-left: 10px !important;
- padding-right: 10px !important;
- box-sizing: border-box;
- overflow: hidden;
- background-clip: padding-box;
- border-radius: 14px;
- }
-
- :deep(.el-sub-menu.is-active > .el-sub-menu__title .menu-title),
- :deep(.el-sub-menu.is-active > .el-sub-menu__title .svg-icon),
- :deep(.el-menu-item.is-active .menu-title),
- :deep(.el-menu-item.is-active .svg-icon) {
- color: v-bind(theme) !important;
- }
-
- :deep(.el-sub-menu__title:hover),
- :deep(.el-menu-item:hover) {
- border-radius: 14px;
- }
}
-}
</style>
--
Gitblit v1.9.3