Logo.vue 2.3 KB

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