moduleBottom.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. @import '/@/design/theme.less';
  26. @{theme-deepblue} {
  27. .module-bottom {
  28. --image-model_bottom_title_bg_expand: url('@/assets/images/themify/deepblue/configurable/model_bottom_title_bg_expand.png');
  29. --image-expand: url('@/assets/images/themify/deepblue/configurable/expand.svg');
  30. }
  31. }
  32. .module-bottom {
  33. --image-model_bottom_title_bg_expand: url('@/assets/images/home-container/configurable/model_bottom_title_bg_expand.png');
  34. --image-expand: url('@/assets/images/home-container/configurable/expand.svg');
  35. --bg-height: 33px;
  36. color: #fff;
  37. box-sizing: border-box;
  38. position: absolute;
  39. .module-content {
  40. width: 100%;
  41. height: 100%;
  42. }
  43. .module-content__title__expand {
  44. width: 100%;
  45. height: var(--bg-height);
  46. line-height: var(--bg-height);
  47. background: var(--image-model_bottom_title_bg_expand) no-repeat;
  48. background-size: 100% 100%;
  49. position: relative;
  50. text-align: left;
  51. padding: 0 0 0 5%;
  52. }
  53. // .module-content__title {
  54. // width: 50%;
  55. // height: var(--bg-height);
  56. // background: url('@/assets/images/home-container/configurable/model_bottom_title_bg.png') no-repeat;
  57. // background-size: 100% 100%;
  58. // position: relative;
  59. // text-align: left;
  60. // padding-left: 5%;
  61. // }
  62. // 固定在父容器右上角的按钮图标
  63. .action-btn {
  64. width: 18px;
  65. height: 18px;
  66. background: var(--image-expand) no-repeat center;
  67. position: absolute;
  68. left: 0;
  69. top: 0;
  70. cursor: pointer;
  71. }
  72. .show-btn {
  73. transform: rotate(-90deg);
  74. }
  75. .module-slot {
  76. height: calc(100% - 33px);
  77. width: 100%;
  78. background-color: var(--vent-configurable-module-bg);
  79. }
  80. }
  81. // Transition动画相关
  82. .v-enter-active,
  83. .v-leave-active {
  84. transition: all 0.3s ease;
  85. }
  86. .v-enter-from,
  87. .v-leave-to {
  88. opacity: 0;
  89. transform: translateY(-33px);
  90. }
  91. </style>