moduleLeft.vue 2.1 KB

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