mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-25 16:07:19 +08:00
73 lines
1.6 KiB
Vue
73 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
import { getTopMenu } from "@/router/utils";
|
|
import { useNav } from "@/layout/hooks/useNav";
|
|
|
|
const props = defineProps({
|
|
collapse: Boolean
|
|
});
|
|
|
|
const { title, getLogo } = useNav();
|
|
</script>
|
|
|
|
<template>
|
|
<div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
|
|
<transition name="sidebarLogoFade">
|
|
<router-link
|
|
v-if="props.collapse"
|
|
key="props.collapse"
|
|
:title="title"
|
|
class="sidebar-logo-link"
|
|
:to="getTopMenu()?.path ?? '/'"
|
|
>
|
|
<img :src="getLogo()" alt="logo" />
|
|
<span class="sidebar-title">{{ title }}</span>
|
|
</router-link>
|
|
<router-link
|
|
v-else
|
|
key="expand"
|
|
:title="title"
|
|
class="sidebar-logo-link"
|
|
:to="getTopMenu()?.path ?? '/'"
|
|
>
|
|
<img :src="getLogo()" alt="logo" />
|
|
<span class="sidebar-title">{{ title }}</span>
|
|
</router-link>
|
|
</transition>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.sidebar-logo-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 48px;
|
|
overflow: hidden;
|
|
|
|
.sidebar-logo-link {
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
align-items: center;
|
|
height: 100%;
|
|
padding-left: 10px;
|
|
|
|
img {
|
|
display: inline-block;
|
|
height: 32px;
|
|
}
|
|
|
|
.sidebar-title {
|
|
display: inline-block;
|
|
height: 32px;
|
|
margin: 2px 0 0 12px;
|
|
overflow: hidden;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
line-height: 32px;
|
|
color: $subMenuActiveText;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
}
|
|
</style>
|