Logo.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="sidebar-logo-container" :class="{ 'collapse': collapse }"
  3. :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
  4. <transition name="sidebarLogoFade">
  5. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  6. <img v-if="logo" :src="logo" class="sidebar-logo" />
  7. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">
  8. {{ title }}</h1>
  9. </router-link>
  10. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  11. <img v-if="logo" :src="logo" class="sidebar-logo" />
  12. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">
  13. {{ title }}</h1>
  14. </router-link>
  15. </transition>
  16. </div>
  17. </template>
  18. <script setup>
  19. import variables from "@/assets/styles/variables.module.scss";
  20. import logo from "@/assets/logo/logo.png";
  21. import useSettingsStore from "@/store/modules/settings";
  22. defineProps({
  23. collapse: {
  24. type: Boolean,
  25. required: true,
  26. },
  27. });
  28. const title = ref("三梵MES制造执行系统");
  29. const settingsStore = useSettingsStore();
  30. const sideTheme = computed(() => settingsStore.sideTheme);
  31. </script>
  32. <style lang="scss" scoped>
  33. .sidebarLogoFade-enter-active {
  34. transition: opacity 1.5s;
  35. }
  36. .sidebarLogoFade-enter,
  37. .sidebarLogoFade-leave-to {
  38. opacity: 0;
  39. }
  40. .sidebar-logo-container {
  41. position: relative;
  42. width: 100%;
  43. height: 50px;
  44. line-height: 50px;
  45. background: #2b2f3a;
  46. text-align: center;
  47. overflow: hidden;
  48. & .sidebar-logo-link {
  49. height: 100%;
  50. width: 100%;
  51. & .sidebar-logo {
  52. width: 32px;
  53. height: 32px;
  54. vertical-align: middle;
  55. margin-right: 12px;
  56. }
  57. & .sidebar-title {
  58. display: inline-block;
  59. margin: 0;
  60. color: #fff;
  61. font-weight: 600;
  62. line-height: 50px;
  63. font-size: 14px;
  64. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  65. vertical-align: middle;
  66. }
  67. }
  68. &.collapse {
  69. .sidebar-logo {
  70. margin-right: 0px;
  71. }
  72. }
  73. }
  74. </style>