moduleBottom.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div class="module-bottom">
  3. <!-- 正常展示模块时 -->
  4. <div class="module-content">
  5. <div class="module-content__title__expand">
  6. <span class="action-btn" :class="{ 'show-btn': !moduleShown }" @click="toggleModuleShown"></span>
  7. {{ title }}
  8. </div>
  9. <Transition>
  10. <div v-if="moduleShown" class="module-slot">
  11. <slot></slot>
  12. </div>
  13. </Transition>
  14. </div>
  15. <!-- 隐藏模块时 -->
  16. <!-- <div v-else class="w-100%">
  17. <div class="module-content__title__expand">
  18. <span class="action-btn" @click="showModel"></span>
  19. {{ title }}
  20. </div>
  21. </div> -->
  22. </div>
  23. </template>
  24. <script lang="ts" setup>
  25. import { ref } from 'vue';
  26. defineProps<{ title: string }>();
  27. const moduleShown = ref(true);
  28. function toggleModuleShown() {
  29. moduleShown.value = !moduleShown.value;
  30. }
  31. </script>
  32. <style lang="less" scoped>
  33. .module-bottom {
  34. --bg-height: 33px;
  35. color: #fff;
  36. box-sizing: border-box;
  37. .module-content {
  38. width: 100%;
  39. height: 100%;
  40. }
  41. .module-content__title__expand {
  42. width: 100%;
  43. height: var(--bg-height);
  44. background: url('../../../../../assets/images/home-container/configurable/model_bottom_title_bg_expand.png') no-repeat;
  45. background-size: 100% 100%;
  46. position: relative;
  47. text-align: left;
  48. padding: 4px 0 0 5%;
  49. }
  50. // .module-content__title {
  51. // width: 50%;
  52. // height: var(--bg-height);
  53. // background: url('../../../../../assets/images/home-container/configurable/model_bottom_title_bg.png') no-repeat;
  54. // background-size: 100% 100%;
  55. // position: relative;
  56. // text-align: left;
  57. // padding-left: 5%;
  58. // }
  59. // 固定在父容器右上角的按钮图标
  60. .action-btn {
  61. width: 18px;
  62. height: 18px;
  63. background: url('../../../../../assets/images/home-container/configurable/expand.svg') no-repeat center;
  64. position: absolute;
  65. left: 0;
  66. top: 0;
  67. }
  68. .show-btn {
  69. transform: rotate(-90deg);
  70. }
  71. .module-slot {
  72. height: calc(100% - 33px);
  73. width: 100%;
  74. background-color: #259ccf22;
  75. }
  76. }
  77. // Transition动画相关
  78. .v-enter-active,
  79. .v-leave-active {
  80. transition: all 0.3s ease;
  81. }
  82. .v-enter-from,
  83. .v-leave-to {
  84. opacity: 0;
  85. transform: translateY(-33px);
  86. }
  87. </style>