index.vue 2.5 KB

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