moduleRight.vue 2.3 KB

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