Logo.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!--
  2. * @Author: 傅豪杰 18516149270@163.com
  3. * @Date: 2023-07-24 13:56:49
  4. * @LastEditors: 傅豪杰 18516149270@163.com
  5. * @LastEditTime: 2023-08-02 11:17:57
  6. * @FilePath: /infrared_remote/admin_web/ruoyi-ui/src/layout/components/Sidebar/Logo.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
  11. <transition name="sidebarLogoFade">
  12. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  13. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
  14. </router-link>
  15. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  16. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
  17. </router-link>
  18. </transition>
  19. </div>
  20. </template>
  21. <script>
  22. import logoImg from '@/assets/logo/logo.png'
  23. import variables from '@/assets/styles/variables.scss'
  24. export default {
  25. name: 'SidebarLogo',
  26. props: {
  27. collapse: {
  28. type: Boolean,
  29. required: true
  30. }
  31. },
  32. computed: {
  33. variables() {
  34. return variables;
  35. },
  36. sideTheme() {
  37. return this.$store.state.settings.sideTheme
  38. }
  39. },
  40. data() {
  41. return {
  42. title: process.env.VUE_APP_TITLE,
  43. logo: logoImg
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. .sidebarLogoFade-enter-active {
  50. transition: opacity 1.5s;
  51. }
  52. .sidebarLogoFade-enter,
  53. .sidebarLogoFade-leave-to {
  54. opacity: 0;
  55. }
  56. .sidebar-logo-container {
  57. position: relative;
  58. width: 100%;
  59. height: 50px;
  60. line-height: 50px;
  61. background: #2b2f3a;
  62. text-align: center;
  63. overflow: hidden;
  64. & .sidebar-logo-link {
  65. height: 100%;
  66. width: 100%;
  67. & .sidebar-logo {
  68. width: 32px;
  69. height: 32px;
  70. vertical-align: middle;
  71. margin-right: 12px;
  72. }
  73. & .sidebar-title {
  74. display: inline-block;
  75. margin: 0;
  76. color: #fff;
  77. font-weight: 600;
  78. line-height: 50px;
  79. font-size: 14px;
  80. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  81. vertical-align: middle;
  82. }
  83. }
  84. &.collapse {
  85. .sidebar-logo {
  86. margin-right: 0px;
  87. }
  88. }
  89. }
  90. </style>