index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="fill-slide">
  3. <div></div>
  4. <div class="header">
  5. <slot name="header" />
  6. <ui-icon class="close" type="close" @click="clickHandler" ctrl />
  7. </div>
  8. <div class="slide-layout">
  9. <ui-slide
  10. :items="data"
  11. :current-index="data.indexOf(active)"
  12. @change="index => $emit('update:active', data[index])"
  13. >
  14. <template v-slot="{raw}">
  15. <template v-if="$slots.default">
  16. <slot :data="raw" />
  17. </template>
  18. <img :src="getStaticFile(getURL ? getURL(raw) : raw.url)" class="image" v-else />
  19. </template>
  20. </ui-slide>
  21. </div>
  22. <div class="foot">
  23. <slot name="foot" />
  24. </div>
  25. </div>
  26. </template>
  27. <script lang="ts" setup>
  28. import UiSlide from "@/components/base/components/slide/index.vue";
  29. import {getStaticFile} from "@/dbo/main";
  30. import UiIcon from "@/components/base/components/icon/index.vue";
  31. type Item = {url: string}
  32. defineProps<{ data: Item[], active: Item, getURL?: (data: any) => string }>()
  33. const emit = defineEmits<{
  34. (e: 'update:active', d: Item): void,
  35. (e: 'quit'): void
  36. }>()
  37. const clickHandler = () => {
  38. emit('quit')
  39. }
  40. </script>
  41. <style scoped lang="scss">
  42. .fill-slide {
  43. position: absolute;
  44. top: 0;
  45. left: 0;
  46. right: 0;
  47. bottom: 0;
  48. background: #000;
  49. z-index: 3;
  50. display: flex;
  51. align-items: center;
  52. justify-content: space-between;
  53. flex-direction: column;
  54. }
  55. .slide-layout {
  56. max-width: 90vw;
  57. width: 840px;
  58. height: 540px;
  59. position: relative;
  60. z-index: 1;
  61. }
  62. .image {
  63. width: 100%;
  64. height: 100%;
  65. object-fit: cover;
  66. border-radius: 4px;
  67. }
  68. .header {
  69. width: 100%;
  70. position: absolute;
  71. z-index: 4;
  72. background: red;
  73. //height: 120px;
  74. }
  75. .close {
  76. position: absolute;
  77. right: 32px;
  78. top: 32px;
  79. font-size: 20px;
  80. color: #fff;
  81. z-index: 1;
  82. }
  83. .foot {
  84. width: 100%;
  85. padding-bottom: 24px;
  86. }
  87. </style>
  88. <style lang="scss">
  89. .fill-slide .ui-slide .ui-gate-layer {
  90. overflow: initial !important;
  91. .ui-gate-slides .ui-gate-content {
  92. transition: all .3s ease;
  93. transform: scale(0.9);
  94. opacity: 0.5 !important;
  95. &.active {
  96. transform: scale(1);
  97. opacity: 1 !important;
  98. }
  99. }
  100. }
  101. </style>