moduleBottom.vue 2.3 KB

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