From 31ab2edfa500364818d2cc2c30acc1f4ae5b8dac Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期二, 20 八月 2024 17:25:30 +0800 Subject: [PATCH] bug修改 --- src/layout/components/Sidebar/Logo.vue | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 7203c7f..1fa61e4 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -1,12 +1,12 @@ <template> <div class="sidebar-logo-container" :class="{ 'collapse': collapse }" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }"> <transition name="sidebarLogoFade"> - <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="firstPage"> - <img v-if="logo" :src="logo" class="sidebar-logo" /> + <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" :to="firstPage"> + <img v-if="logoImg" :src="logoImg" class="sidebar-logo" /> <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1> </router-link> <router-link v-else key="expand" class="sidebar-logo-link" :to="firstPage"> - <img v-if="logo" :src="logo" class="sidebar-logo" /> + <img v-if="logoImg" :src="logoImg" class="sidebar-logo" /> <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1> </router-link> </transition> @@ -25,10 +25,29 @@ required: true } }) +const logoImg = ref('') const firstPage = ref(""); onMounted(() => { const routers = JSON.parse(Cookies.get('routers')) ; - firstPage.value = routers[0].path; + if(routers[0].children){ + firstPage.value = routers[0].path + '/' + routers[0].children[0].path; + }else { + firstPage.value = routers[0].path; + } + + console.log(routers,'firstPage.value') + console.log(firstPage.value,'firstPage.value') + if(Cookies.get('configInfo')){ + const config = JSON.parse(Cookies.get('configInfo')) + if(config.logoPath != ''){ + logoImg.value = import.meta.env.VITE_APP_BASE_API + "/" + config.logoPath + }else { + logoImg.value = logo + } + }else { + logoImg.value = logo + } + }); const title = import.meta.env.VITE_APP_TITLE; @@ -62,9 +81,9 @@ & .sidebar-logo { width: 32px; - height: 32px; + height: auto; vertical-align: middle; - //margin-right: 8px; + margin-right: 5px; } & .sidebar-title { -- Gitblit v1.9.2