Logo.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
  3. <transition name="sidebarLogoFade">
  4. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  5. <img v-if="logo" :src="logo" class="sidebar-logo" />
  6. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
  7. </router-link>
  8. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  9. <img v-if="logo" :src="logo" class="sidebar-logo" />
  10. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
  11. </router-link>
  12. </transition>
  13. </div>
  14. </template>
  15. <script>
  16. import logoImg from '@/assets/logo/logo.png'
  17. import variables from '@/assets/styles/variables.scss'
  18. export default {
  19. name: 'SidebarLogo',
  20. props: {
  21. collapse: {
  22. type: Boolean,
  23. required: true
  24. }
  25. },
  26. computed: {
  27. variables() {
  28. return variables;
  29. },
  30. sideTheme() {
  31. return this.$store.state.settings.sideTheme
  32. }
  33. },
  34. data() {
  35. return {
  36. // title: process.env.VUE_APP_TITLE,
  37. title:process.env.VUE_APP_TITLE,
  38. logo: logoImg
  39. // logo: ''
  40. }
  41. },
  42. created(){
  43. // console.log("logo===",this.$store.state.systemTitle)
  44. if(this.$route.query.title){
  45. this.title = this.$route.query.title;
  46. }
  47. // this.title = this.$store.state.systemTitle
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .sidebarLogoFade-enter-active {
  53. transition: opacity 1.5s;
  54. }
  55. .sidebarLogoFade-enter,
  56. .sidebarLogoFade-leave-to {
  57. opacity: 0;
  58. }
  59. .sidebar-logo-container {
  60. position: relative;
  61. width: 100%;
  62. height: 50px;
  63. line-height: 50px;
  64. background: #2b2f3a;
  65. text-align: center;
  66. overflow: hidden;
  67. & .sidebar-logo-link {
  68. height: 100%;
  69. width: 100%;
  70. & .sidebar-logo {
  71. width: 32px;
  72. height: 32px;
  73. vertical-align: middle;
  74. margin-right: 12px;
  75. }
  76. & .sidebar-title {
  77. display: inline-block;
  78. margin: 0;
  79. color: #fff;
  80. font-weight: 600;
  81. line-height: 50px;
  82. font-size: 14px;
  83. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  84. vertical-align: middle;
  85. }
  86. }
  87. &.collapse {
  88. .sidebar-logo {
  89. margin-right: 0px;
  90. }
  91. }
  92. }
  93. </style>