1
0

moduleBottom.vue 2.1 KB

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