forked from dyf/dyf-vue-ui
87 lines
2.1 KiB
Vue
87 lines
2.1 KiB
Vue
<template>
|
|
<div
|
|
class="sidebar-logo-container"
|
|
:class="{ collapse: collapse }"
|
|
:style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }"
|
|
>
|
|
<transition :enter-active-class="proxy?.animate.logoAnimate.enter" mode="out-in">
|
|
<router-link class="sidebar-logo-link" to="/">
|
|
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">
|
|
{{ title }}
|
|
</h1>
|
|
</router-link>
|
|
</transition>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import variables from '@/assets/styles/variables.module.scss';
|
|
import { useSettingsStore } from '@/store/modules/settings';
|
|
import { useUserStore } from '@/store/modules/user';
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
defineProps({
|
|
collapse: {
|
|
type: Boolean,
|
|
required: true
|
|
}
|
|
});
|
|
|
|
const userStore = useUserStore();
|
|
const settingsStore = useSettingsStore();
|
|
|
|
// 使用计算属性动态获取标题
|
|
const title = computed(() => {
|
|
return userStore.tenantName || import.meta.env.VITE_APP_TITLE || '云平台管理系统';
|
|
});
|
|
|
|
const sideTheme = computed(() => settingsStore.sideTheme);
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.sidebarLogoFade-enter-active {
|
|
transition: opacity 1.5s;
|
|
}
|
|
|
|
.sidebarLogoFade-enter,
|
|
.sidebarLogoFade-leave-to {
|
|
opacity: 0;
|
|
}
|
|
|
|
.sidebar-logo-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 50px;
|
|
line-height: 50px;
|
|
background: #2c3e50; // 精确匹配设计UI的背景色
|
|
text-align: center;
|
|
overflow: hidden;
|
|
|
|
& .sidebar-logo-link {
|
|
height: 100%;
|
|
width: 100%;
|
|
|
|
& .sidebar-title {
|
|
display: block;
|
|
margin: 0;
|
|
padding: 0 15px; // 增加左右内边距
|
|
color: #fff;
|
|
font-weight: 600;
|
|
line-height: 50px;
|
|
font-size: 16px; // 恢复正常字体大小
|
|
font-family:
|
|
Avenir,
|
|
Helvetica Neue,
|
|
Arial,
|
|
Helvetica,
|
|
sans-serif;
|
|
width: 100%; // 使用全宽
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
text-align: center; // 居中显示
|
|
}
|
|
}
|
|
}
|
|
</style>
|