Logo.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. import { ComponentInternalInstance } from "vue";
  28. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  29. defineProps({
  30. collapse: {
  31. type: Boolean,
  32. required: true
  33. }
  34. })
  35. const title = ref('RuoYi-Vue-Plus');
  36. const settingsStore = useSettingsStore();
  37. const sideTheme = computed(() => settingsStore.sideTheme);
  38. </script>
  39. <style lang="scss" scoped>
  40. .sidebarLogoFade-enter-active {
  41. transition: opacity 1.5s;
  42. }
  43. .sidebarLogoFade-enter,
  44. .sidebarLogoFade-leave-to {
  45. opacity: 0;
  46. }
  47. .sidebar-logo-container {
  48. position: relative;
  49. width: 100%;
  50. height: 50px;
  51. line-height: 50px;
  52. background: #2b2f3a;
  53. text-align: center;
  54. overflow: hidden;
  55. & .sidebar-logo-link {
  56. height: 100%;
  57. width: 100%;
  58. & .sidebar-logo {
  59. width: 32px;
  60. height: 32px;
  61. vertical-align: middle;
  62. margin-right: 12px;
  63. }
  64. & .sidebar-title {
  65. display: inline-block;
  66. margin: 0;
  67. color: #fff;
  68. font-weight: 600;
  69. line-height: 50px;
  70. font-size: 14px;
  71. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  72. vertical-align: middle;
  73. }
  74. }
  75. &.collapse {
  76. .sidebar-logo {
  77. margin-right: 0px;
  78. }
  79. }
  80. }
  81. </style>