index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="logo">
  3. <transition enter-active-class="animate__animated animate__fadeInLeft">
  4. <router-link :key="+collapse" class="wh-full flex-center" to="/">
  5. <img :src="logo" class="w40px h40px" />
  6. <span v-if="!collapse" class="title">
  7. {{ defaultSettings.title }}
  8. </span>
  9. </router-link>
  10. </transition>
  11. </div>
  12. </template>
  13. <script lang="ts" setup>
  14. import { defaultSettings } from "@/settings";
  15. import logo from "@/assets/logo.svg";
  16. defineProps({
  17. collapse: {
  18. type: Boolean,
  19. required: true,
  20. },
  21. });
  22. </script>
  23. <style lang="scss" scoped>
  24. .logo {
  25. width: 100%;
  26. height: $navbar-height;
  27. background-color: $sidebar-logo-background;
  28. .title {
  29. flex-shrink: 0;
  30. margin-left: 10px;
  31. font-size: 14px;
  32. font-weight: bold;
  33. color: $sidebar-logo-text-color;
  34. }
  35. }
  36. </style>
  37. <style lang="scss">
  38. // 顶部布局和混合布局的特殊处理
  39. .layout-top,
  40. .layout-mix {
  41. .logo {
  42. background-color: transparent !important;
  43. .title {
  44. color: var(--menu-text);
  45. }
  46. }
  47. }
  48. // 宽屏时:openSidebar 状态下显示完整Logo+文字
  49. .openSidebar {
  50. &.layout-top .layout__header-left .logo,
  51. &.layout-mix .layout__header-logo .logo {
  52. width: $sidebar-width; // 210px,显示logo+文字
  53. }
  54. }
  55. // 窄屏时:hideSidebar 状态下只显示Logo图标
  56. .hideSidebar {
  57. &.layout-top .layout__header-left .logo,
  58. &.layout-mix .layout__header-logo .logo {
  59. width: $sidebar-width-collapsed; // 54px,只显示logo
  60. }
  61. // 隐藏文字,只显示图标
  62. .logo .title {
  63. display: none;
  64. }
  65. }
  66. </style>