Logo.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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="sideTheme === 'theme-dark'? logo : logoYT" class="sidebar-logo" />
  6. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ $store.state.user.companyName }} </h1>
  7. </router-link>
  8. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  9. <img v-if="logo" :src="sideTheme === 'theme-dark'? logo : logoYT" class="sidebar-logo" />
  10. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ $store.state.user.companyName }} </h1>
  11. </router-link>
  12. </transition>
  13. </div>
  14. </template>
  15. <script>
  16. import logoImg from '@/assets/images/logo@2xS.png'
  17. import logoYTImg from '@/assets/images/logo@2xSYT.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: '',
  38. logo: logoImg,
  39. logoYT:logoYTImg,
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .sidebarLogoFade-enter-active {
  46. transition: opacity 1.5s;
  47. }
  48. .sidebarLogoFade-enter,
  49. .sidebarLogoFade-leave-to {
  50. opacity: 0;
  51. }
  52. .sidebar-logo-container {
  53. position: relative;
  54. width: 100%;
  55. height: 50px;
  56. line-height: 50px;
  57. background: #2b2f3a;
  58. text-align: center;
  59. overflow: hidden;
  60. & .sidebar-logo-link {
  61. height: 100%;
  62. width: 100%;
  63. & .sidebar-logo {
  64. width: 37.4px;
  65. height: 27px;
  66. vertical-align: middle;
  67. margin-right: 12px;
  68. }
  69. & .sidebar-title {
  70. display: inline-block;
  71. margin: 0;
  72. color: #fff;
  73. font-weight: bold;
  74. line-height: 50px;
  75. font-size: 16px;
  76. font-family: "Heiti SC","黑体-简";
  77. vertical-align: middle;
  78. }
  79. }
  80. &.collapse {
  81. .sidebar-logo {
  82. margin-right: 0px;
  83. }
  84. }
  85. }
  86. </style>