From f2a0f694655c5b58b7f9fd002493bdaa393ae6ff Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期一, 21 四月 2025 15:29:14 +0800
Subject: [PATCH] 显隐列组件支持全选/全不选
---
src/layout/components/Sidebar/Logo.vue | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue
index 962600e..751b56e 100644
--- a/src/layout/components/Sidebar/Logo.vue
+++ b/src/layout/components/Sidebar/Logo.vue
@@ -1,22 +1,22 @@
<template>
- <div class="sidebar-logo-container" :class="{ 'collapse': collapse }" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
+ <div class="sidebar-logo-container" :class="{ 'collapse': collapse }">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
- <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
+ <h1 v-else class="sidebar-title">{{ title }}</h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
- <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
+ <h1 class="sidebar-title">{{ title }}</h1>
</router-link>
</transition>
</div>
</template>
<script setup>
-import variables from '@/assets/styles/variables.module.scss'
import logo from '@/assets/logo/logo.png'
import useSettingsStore from '@/store/modules/settings'
+import variables from '@/assets/styles/variables.module.scss'
defineProps({
collapse: {
@@ -25,12 +25,30 @@
}
})
-const title = ref('鑻ヤ緷绠$悊绯荤粺');
+const title = import.meta.env.VITE_APP_TITLE;
const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme);
+
+// 鑾峰彇Logo鑳屾櫙鑹�
+const getLogoBackground = computed(() => {
+ if (settingsStore.isDark) {
+ return 'var(--sidebar-bg)';
+ }
+ return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg;
+});
+
+// 鑾峰彇Logo鏂囧瓧棰滆壊
+const getLogoTextColor = computed(() => {
+ if (settingsStore.isDark) {
+ return 'var(--sidebar-text)';
+ }
+ return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText;
+});
</script>
<style lang="scss" scoped>
+@import '@/assets/styles/variables.module.scss';
+
.sidebarLogoFade-enter-active {
transition: opacity 1.5s;
}
@@ -45,7 +63,7 @@
width: 100%;
height: 50px;
line-height: 50px;
- background: #2b2f3a;
+ background: v-bind(getLogoBackground);
text-align: center;
overflow: hidden;
@@ -63,7 +81,7 @@
& .sidebar-title {
display: inline-block;
margin: 0;
- color: #fff;
+ color: v-bind(getLogoTextColor);
font-weight: 600;
line-height: 50px;
font-size: 14px;
--
Gitblit v1.9.3