Logo.vue 2.3 KB

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