index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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="configStore.configData.sys_web_logo.config_value" class="w50px h50px" />-->
  6. <span v-if="!collapse" class="title">
  7. {{ configStore.configData.sys_web_title.config_value }}
  8. </span>
  9. </router-link>
  10. </transition>
  11. </div>
  12. </template>
  13. <script lang="ts" setup>
  14. import { useConfigStore } from "@/store";
  15. const configStore = useConfigStore();
  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: var(--layout-logo-bg);
  28. .title {
  29. max-width: 100px;
  30. margin-left: 10px;
  31. overflow: hidden;
  32. text-overflow: ellipsis;
  33. font-size: 14px;
  34. font-weight: bold;
  35. color: $sidebar-logo-text-color;
  36. white-space: nowrap;
  37. }
  38. }
  39. </style>
  40. <style lang="scss">
  41. // 顶部布局和混合布局的特殊处理
  42. .layout-top,
  43. .layout-mix {
  44. .logo {
  45. background-color: transparent !important;
  46. .title {
  47. color: var(--menu-text);
  48. }
  49. }
  50. }
  51. // 宽屏时:openSidebar 状态下显示完整Logo+文字
  52. .openSidebar {
  53. &.layout-top .layout__header-left .logo,
  54. &.layout-mix .layout__header-logo .logo {
  55. width: $sidebar-width; // 210px,显示logo+文字
  56. }
  57. }
  58. // 窄屏时:hideSidebar 状态下只显示Logo图标
  59. .hideSidebar {
  60. &.layout-top .layout__header-left .logo,
  61. &.layout-mix .layout__header-logo .logo {
  62. width: $sidebar-width-collapsed; // 54px,只显示logo
  63. }
  64. // 隐藏文字,只显示图标
  65. .logo .title {
  66. display: none;
  67. }
  68. }
  69. </style>