index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div
  3. class="logo"
  4. :class="{
  5. 'collapsed-login': isCollapsed,
  6. }"
  7. >
  8. <img src="~@/assets/images/skyeye-logo-img.png" alt="" :class="{ 'mr-2': !isCollapsed }" />
  9. <img
  10. v-show="!isCollapsed || navMode === 'horizontal' || (navMode === 'horizontal-mix' && mixMenu)"
  11. class="mt-0 title"
  12. src="~@/assets/images/skyeye-logo-text.png"
  13. alt=""
  14. :class="{ 'mr-2': !isCollapsed }"
  15. />
  16. </div>
  17. </template>
  18. <script lang="ts" setup>
  19. import { inject, computed, unref } from 'vue';
  20. import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
  21. import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
  22. const { getNavTheme, getMenuWidth, getMenuMinWidth, getNavMode, getMenuSetting } =
  23. useProjectSetting();
  24. const { getDarkTheme } = useDesignSetting();
  25. const isCollapsed = inject('collapsed');
  26. const navMode = getNavMode;
  27. const getBgColor = computed(() => {
  28. let isLight = getNavTheme.value === 'light';
  29. return getDarkTheme.value ? 'rgb(24, 24, 28)' : isLight ? '#fff' : '#001428';
  30. });
  31. const getColor = computed(() => {
  32. let isLight = getNavTheme.value === 'light';
  33. return isLight ? '#333' : '#FFFFFF';
  34. });
  35. const mixMenu = computed(() => {
  36. return unref(getMenuSetting).mixMenu;
  37. });
  38. const menuWidth = computed(() => {
  39. return getMenuWidth.value + 'px';
  40. });
  41. const minMenuWidth = computed(() => {
  42. return getMenuMinWidth.value + 'px';
  43. });
  44. </script>
  45. <style lang="scss" scoped>
  46. .logo {
  47. width: v-bind(menuWidth);
  48. display: flex;
  49. align-items: center;
  50. justify-content: center;
  51. height: 64px;
  52. line-height: 64px;
  53. overflow: hidden;
  54. white-space: nowrap;
  55. background: v-bind(getBgColor);
  56. color: v-bind(getColor);
  57. transition: width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s, left 0.3s cubic-bezier(0.2, 0, 0, 1) 0s,
  58. box-shadow 0.3s cubic-bezier(0.2, 0, 0, 1) 0s, border-color var(--el-transition-duration),
  59. background-color var(--el-transition-duration), color var(--el-transition-duration);
  60. img {
  61. width: auto;
  62. height: 32px;
  63. }
  64. .title {
  65. margin-bottom: 0;
  66. }
  67. }
  68. .collapsed-login {
  69. width: v-bind(minMenuWidth);
  70. }
  71. </style>