Logo.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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="logImg" :src="logImg" 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="logImg" :src="logImg" 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 variables from '@/assets/styles/variables.scss'
  17. export default {
  18. name: 'SidebarLogo',
  19. props: {
  20. collapse: {
  21. type: Boolean,
  22. required: true
  23. }
  24. },
  25. computed: {
  26. variables() {
  27. return variables;
  28. },
  29. sideTheme() {
  30. return this.$store.state.settings.sideTheme
  31. }
  32. },
  33. data() {
  34. return {
  35. title: process.env.VUE_APP_TITLE_INDEX || "互联网医院SCRM",
  36. }
  37. }
  38. }
  39. </script>
  40. <style lang="scss" scoped>
  41. .sidebarLogoFade-enter-active {
  42. transition: opacity 1.5s;
  43. }
  44. .sidebarLogoFade-enter,
  45. .sidebarLogoFade-leave-to {
  46. opacity: 0;
  47. }
  48. .sidebar-logo-container {
  49. position: relative;
  50. width: 100%;
  51. height: 50px;
  52. line-height: 50px;
  53. background: #2b2f3a;
  54. text-align: center;
  55. overflow: hidden;
  56. & .sidebar-logo-link {
  57. height: 100%;
  58. width: 100%;
  59. & .sidebar-logo {
  60. width: 32px;
  61. height: 32px;
  62. vertical-align: middle;
  63. margin-right: 12px;
  64. }
  65. & .sidebar-title {
  66. display: inline-block;
  67. margin: 0;
  68. color: #fff;
  69. font-weight: bold;
  70. line-height: 50px;
  71. font-size: 16px;
  72. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  73. vertical-align: middle;
  74. }
  75. }
  76. &.collapse {
  77. .sidebar-logo {
  78. margin-right: 0px;
  79. }
  80. }
  81. }
  82. </style>