Logo.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div
  3. class="sidebar-logo-container"
  4. :class="{ collapse: collapse }"
  5. :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }"
  6. >
  7. <transition :enter-active-class="proxy?.animate.logoAnimate.enter" mode="out-in">
  8. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  9. <img v-if="logo" :src="logo" class="sidebar-logo" />
  10. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">
  11. {{ title }}
  12. </h1>
  13. </router-link>
  14. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  15. <img v-if="logo" :src="logo" class="sidebar-logo" />
  16. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">
  17. {{ title }}
  18. </h1>
  19. </router-link>
  20. </transition>
  21. </div>
  22. </template>
  23. <script setup lang="ts">
  24. import variables from '@/assets/styles/variables.module.scss';
  25. import logo from '@/assets/logo/logo.png';
  26. import { useSettingsStore } from '@/store/modules/settings';
  27. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  28. defineProps({
  29. collapse: {
  30. type: Boolean,
  31. required: true
  32. }
  33. });
  34. const title = ref('RuoYi-Vue-Plus');
  35. const settingsStore = useSettingsStore();
  36. const sideTheme = computed(() => settingsStore.sideTheme);
  37. </script>
  38. <style lang="scss" scoped>
  39. .sidebarLogoFade-enter-active {
  40. transition: opacity 1.5s;
  41. }
  42. .sidebarLogoFade-enter,
  43. .sidebarLogoFade-leave-to {
  44. opacity: 0;
  45. }
  46. .sidebar-logo-container {
  47. position: relative;
  48. width: 100%;
  49. height: 50px;
  50. line-height: 50px;
  51. background: #2b2f3a;
  52. text-align: center;
  53. overflow: hidden;
  54. & .sidebar-logo-link {
  55. height: 100%;
  56. width: 100%;
  57. & .sidebar-logo {
  58. width: 32px;
  59. height: 32px;
  60. vertical-align: middle;
  61. margin-right: 12px;
  62. }
  63. & .sidebar-title {
  64. display: inline-block;
  65. margin: 0;
  66. color: #fff;
  67. font-weight: 600;
  68. line-height: 50px;
  69. font-size: 14px;
  70. font-family:
  71. Avenir,
  72. Helvetica Neue,
  73. Arial,
  74. Helvetica,
  75. sans-serif;
  76. vertical-align: middle;
  77. }
  78. }
  79. &.collapse {
  80. .sidebar-logo {
  81. margin-right: 0px;
  82. }
  83. }
  84. }
  85. </style>