index.vue 2.5 KB

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