<template> <div class="sidebar-logo-container" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground, }" > <transition name="sidebarLogoFade" class="logo-header"> <router-link class="sidebar-logo-link logo-header" to="/"> <img :src="logo" class="sidebar-logo" /> <h1 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="/"> <img v-if="logo" :src="logo" class="sidebar-logo" /> <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor, }" > {{ title }} </h1> </router-link> --> </transition> <navbar /> </div> </template> <script> import logoImg from "@/assets/logo/logo_ks.png"; import variables from "@/assets/styles/variables.scss"; import { Navbar } from "../../components"; import { listSet } from "@/api/system/perSet"; export default { name: "SidebarLogo", components: { Navbar, }, // props: { // collapse: { // type: Boolean, // required: true, // }, // }, computed: { variables() { return variables; }, sideTheme() { return this.$store.state.settings.sideTheme; }, }, data() { return { previewUrl: process.env.VUE_APP_BASE_API, title: "隧道结构稳定性监测系统", logo: logoImg, }; }, created() { this.getList() }, methods: { getList() { listSet().then(response => { if(response.code===200&&response&&response.rows&&response.rows[0]){ this.title = response.rows[0].title||"隧道结构稳定性监测系统"; this.logo = this.previewUrl + response.rows[0].url||logoImg; } }); }, } }; </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: 64px; line-height: 64px; background: url("~@/assets/images/m_title_2.png"); background-size: 100%; // text-align: center; overflow: hidden; padding-left: 20px; & .sidebar-logo-link { height: 100%; width: 50%; float: left; & .sidebar-logo { width: 250px; height: 50px; vertical-align: middle; margin-right: 12px; } & .sidebar-title { display: inline-block; margin: 0; color: #fff; font-weight: 600; line-height: 64px; font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif; vertical-align: middle; font-size: 30px; background-image: -webkit-linear-gradient(top, #fff, #fff, #b5cbfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } } &.collapse { .sidebar-logo { margin-right: 0px; } } } </style>