index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <script lang="ts" setup>
  2. import { useSettingsStore } from '@/store/modules/settings'
  3. const settingsStore = useSettingsStore()
  4. const { theme, logo, title } = storeToRefs(settingsStore)
  5. </script>
  6. <template>
  7. <div
  8. class="logo-container"
  9. :class="{
  10. ['logo-container-' + theme.layout]: true,
  11. }"
  12. >
  13. <router-link to="/">
  14. <span class="logo">
  15. <!-- 使用自定义svg示例 -->
  16. <vab-icon v-if="logo" :icon="logo" is-custom-svg />
  17. </span>
  18. <span
  19. class="title"
  20. :class="{ 'hidden-xs-only': theme.layout === 'horizontal' }"
  21. >
  22. {{ title }}
  23. </span>
  24. </router-link>
  25. </div>
  26. </template>
  27. <style lang="scss" scoped>
  28. @mixin container {
  29. position: relative;
  30. height: $base-header-height;
  31. overflow: hidden;
  32. line-height: $base-header-height;
  33. background: transparent;
  34. }
  35. @mixin logo {
  36. display: inline-block;
  37. width: 32px;
  38. height: 32px;
  39. color: $base-title-color;
  40. vertical-align: middle;
  41. fill: currentColor;
  42. }
  43. @mixin title {
  44. display: inline-block;
  45. margin-left: 5px;
  46. overflow: hidden;
  47. font-size: 20px;
  48. line-height: 55px;
  49. color: $base-title-color;
  50. text-overflow: ellipsis;
  51. white-space: nowrap;
  52. vertical-align: middle;
  53. }
  54. .logo-container {
  55. &-horizontal,
  56. &-common {
  57. @include container;
  58. .logo {
  59. svg,
  60. img {
  61. @include logo;
  62. }
  63. }
  64. .title {
  65. @include title;
  66. }
  67. }
  68. &-vertical,
  69. &-column,
  70. &-comprehensive,
  71. &-float {
  72. @include container;
  73. height: $base-logo-height;
  74. line-height: $base-logo-height;
  75. text-align: center;
  76. .logo {
  77. svg,
  78. img {
  79. @include logo;
  80. }
  81. }
  82. .title {
  83. @include title;
  84. max-width: calc(var(--el-left-menu-width) - 60px);
  85. }
  86. }
  87. &-column {
  88. background: $base-column-second-menu-background !important;
  89. .logo {
  90. position: fixed;
  91. top: 0;
  92. display: block;
  93. width: $base-left-menu-width-min;
  94. height: $base-logo-height;
  95. margin: 0;
  96. background: $base-column-first-menu-background;
  97. }
  98. .title {
  99. padding-right: 15px;
  100. padding-left: 15px;
  101. margin-left: $base-left-menu-width-min !important;
  102. color: var(--el-color-black) !important;
  103. background: $base-column-second-menu-background !important;
  104. @include title;
  105. }
  106. }
  107. }
  108. </style>