moduleRight.vue 2.9 KB

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