Logo.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <script lang="ts" setup>
  2. import { useSettingsStore } from "@/store/modules/settings";
  3. const settingsStore = useSettingsStore();
  4. defineProps({
  5. collapse: {
  6. type: Boolean,
  7. required: true,
  8. },
  9. });
  10. const logo = ref(new URL(`../../../assets/logo.png`, import.meta.url).href);
  11. const logoIco = ref(
  12. new URL(`../../../assets/logo-icon.png`, import.meta.url).href
  13. );
  14. </script>
  15. <template>
  16. <div class="w-full">
  17. <transition name="sidebarLogoFade">
  18. <router-link
  19. v-if="collapse"
  20. key="collapse"
  21. class="logo w-full flex items-center justify-center"
  22. to="/"
  23. >
  24. <img v-if="settingsStore.sidebarLogo" :src="logoIco" class="h-11" />
  25. </router-link>
  26. <router-link
  27. v-else
  28. key="expand"
  29. class="logo w-full flex items-center justify-center"
  30. to="/"
  31. >
  32. <img v-if="settingsStore.sidebarLogo" :src="logo" class="h-11" />
  33. </router-link>
  34. </transition>
  35. </div>
  36. </template>
  37. <style lang="scss" scoped>
  38. .sidebarLogoFade-enter-active {
  39. transition: opacity 2s;
  40. }
  41. .sidebarLogoFade-leave-active,
  42. .sidebarLogoFade-enter-from,
  43. .sidebarLogoFade-leave-to {
  44. opacity: 0;
  45. }
  46. .logo {
  47. height: 70px;
  48. line-height: 70px;
  49. }
  50. </style>