moduleLeft.vue 2.9 KB

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