Files

115 lines
2.7 KiB
Vue
Raw Normal View History

2021-11-30 09:55:37 +08:00
<template>
2022-07-18 17:34:29 +08:00
<div
class="sidebar-logo-container"
:class="{ collapse: collapse }"
:style="{
backgroundColor:
sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground,
}"
>
2021-11-30 09:55:37 +08:00
<transition name="sidebarLogoFade">
2022-07-18 17:34:29 +08:00
<router-link
v-if="collapse"
key="collapse"
class="sidebar-logo-link"
to="/"
>
<img v-if="logoSmall" :src="logoSmall" class="sidebar-logo-small" />
<h1
v-else
class="sidebar-title"
:style="{
color:
sideTheme === 'theme-dark'
? variables.logoTitleColor
: variables.logoLightTitleColor,
}"
>
{{ title }}
</h1>
2021-11-30 09:55:37 +08:00
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
2022-07-18 17:34:29 +08:00
<!-- <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1> -->
2021-11-30 09:55:37 +08:00
</router-link>
</transition>
</div>
</template>
<script setup>
2022-07-18 17:34:29 +08:00
import variables from "@/assets/styles/variables.module.scss";
import logo from "@/assets/logo/logo.png";
import logoSmall from "@/assets/logo/logo_small.png";
import useSettingsStore from "@/store/modules/settings";
2021-11-30 09:55:37 +08:00
defineProps({
collapse: {
type: Boolean,
2022-07-18 17:34:29 +08:00
required: true,
},
});
2021-11-30 09:55:37 +08:00
2022-07-18 17:34:29 +08:00
const title = ref("若依管理系统");
const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme);
2021-11-30 09:55:37 +08:00
</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: #2b2f3a;
text-align: center;
overflow: hidden;
& .sidebar-logo-link {
height: 100%;
width: 100%;
& .sidebar-logo {
2022-07-18 17:34:29 +08:00
width: 75px;
height: 22px;
2021-11-30 09:55:37 +08:00
vertical-align: middle;
margin-right: 12px;
}
2022-07-18 17:34:29 +08:00
& .sidebar-logo-small {
// width: 32px;
width: unset;
height: 22px;
vertical-align: middle;
// margin-right: 12px;
margin-right: 0;
}
2021-11-30 09:55:37 +08:00
& .sidebar-title {
display: inline-block;
margin: 0;
color: #fff;
font-weight: 600;
line-height: 50px;
font-size: 14px;
font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
vertical-align: middle;
}
}
&.collapse {
.sidebar-logo {
margin-right: 0px;
}
}
}
2022-07-18 17:34:29 +08:00
</style>