index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. <img alt="" src="@/assets/logo.png" srcset="" />
  18. </span>
  19. <span
  20. class="title"
  21. :class="{ 'hidden-xs-only': theme.layout === 'horizontal' }"
  22. >
  23. {{ title }}
  24. </span>
  25. </router-link>
  26. </div>
  27. </template>
  28. <style lang="scss" scoped>
  29. @mixin container {
  30. position: relative;
  31. height: $base-header-height;
  32. overflow: hidden;
  33. line-height: $base-header-height;
  34. background: transparent;
  35. }
  36. @mixin logo {
  37. display: inline-block;
  38. width: 32px;
  39. height: 32px;
  40. color: $base-title-color;
  41. vertical-align: middle;
  42. fill: currentColor;
  43. }
  44. @mixin title {
  45. display: inline-block;
  46. margin-left: 5px;
  47. overflow: hidden;
  48. font-size: 20px;
  49. line-height: 55px;
  50. color: $base-title-color;
  51. text-overflow: ellipsis;
  52. white-space: nowrap;
  53. vertical-align: middle;
  54. }
  55. .logo-container {
  56. &-horizontal,
  57. &-common {
  58. @include container;
  59. .logo {
  60. svg,
  61. img {
  62. @include logo;
  63. }
  64. }
  65. .title {
  66. @include title;
  67. }
  68. }
  69. &-vertical,
  70. &-column,
  71. &-comprehensive,
  72. &-float {
  73. @include container;
  74. height: $base-logo-height;
  75. line-height: $base-logo-height;
  76. text-align: center;
  77. .logo {
  78. svg,
  79. img {
  80. @include logo;
  81. }
  82. }
  83. .title {
  84. @include title;
  85. max-width: calc(var(--el-left-menu-width) - 60px);
  86. }
  87. }
  88. &-column {
  89. background: $base-column-second-menu-background !important;
  90. .logo {
  91. position: fixed;
  92. top: 0;
  93. display: block;
  94. width: $base-left-menu-width-min;
  95. height: $base-logo-height;
  96. margin: 0;
  97. background: $base-column-first-menu-background;
  98. }
  99. .title {
  100. padding-right: 15px;
  101. padding-left: 15px;
  102. margin-left: $base-left-menu-width-min !important;
  103. color: var(--el-color-black) !important;
  104. background: $base-column-second-menu-background !important;
  105. @include title;
  106. }
  107. }
  108. }
  109. </style>