show.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import { Swiper, SwiperSlide } from 'swiper/vue'
  4. import { Autoplay, EffectCards, Navigation, Pagination } from 'swiper/modules'
  5. import 'swiper/css'
  6. import 'swiper/css/navigation'
  7. import 'swiper/css/autoplay'
  8. import 'swiper/css/pagination'
  9. import 'swiper/css/effect-cards'
  10. // import 'swiper/css/bundle' // 全部css
  11. const modules = [Navigation, Pagination, EffectCards, Autoplay]
  12. const { openLoginModal } = useLoginModal()
  13. const swiperVertical = ref<any>(null)
  14. const swiperHorizontal = ref<any>(null)
  15. function onVerticalSwiper(swiper: any) {
  16. swiperVertical.value = swiper
  17. }
  18. function onHorizontalSwiper(swiper: any) {
  19. swiperHorizontal.value = swiper
  20. }
  21. function onSlideChange(swiper: any) {
  22. if (!swiperVertical.value)
  23. return
  24. swiperVertical.value.slideTo(swiper.realIndex)
  25. }
  26. function onSlideChange2(swiper: any) {
  27. if (!swiperHorizontal.value)
  28. return
  29. swiperHorizontal.value.slideTo(swiper.realIndex)
  30. }
  31. const list = ref([
  32. {
  33. title: 'Insight-Driven Creativity111',
  34. description:
  35. 'We believe creativity should be rooted in real consumer insights. Every idea starts with what the new generation truly wants — we turn those insights into inspiring products.',
  36. },
  37. {
  38. title: 'Insight-Driven Creativity22',
  39. description:
  40. 'We believe creativity should be rooted in real consumer insights. Every idea starts with what the new generation truly wants — we turn those insights into inspiring products.',
  41. },
  42. {
  43. title: 'Insight-Driven Creativity333',
  44. description:
  45. 'We believe creativity should be rooted in real consumer insights. Every idea starts with what the new generation truly wants — we turn those insights into inspiring products.',
  46. },
  47. ])
  48. onUnmounted(() => {
  49. if (swiperVertical.value) {
  50. swiperVertical.value.destroy()
  51. swiperVertical.value = null
  52. }
  53. })
  54. </script>
  55. <template>
  56. <div class="bg-#EAE5FA">
  57. <div class="w-1200-auto">
  58. <div class="flex justify-between ">
  59. <div class="w-50% block-left flex user-select justify-center items-center pr-100px">
  60. <Swiper
  61. :modules="modules"
  62. :mousewheel="false"
  63. :loop="true"
  64. effect="cards"
  65. :grab-cursor="true"
  66. :autoplay="{
  67. delay: 3000,
  68. disableOnInteraction: false,
  69. pauseOnMouseEnter: true,
  70. }"
  71. :pagination="{
  72. clickable: true,
  73. }"
  74. class="pos-relative"
  75. @slide-change="onSlideChange2"
  76. @swiper="onVerticalSwiper"
  77. >
  78. <SwiperSlide v-for="(item, index) in list" :key="index">
  79. Slide {{ index }}
  80. </SwiperSlide>
  81. </Swiper>
  82. </div>
  83. <div class="w-50% h-700px pos-relative block-right">
  84. <Swiper
  85. direction="vertical"
  86. :modules="modules"
  87. :mousewheel="false"
  88. :loop="true"
  89. :allow-touch-move="false"
  90. :pagination="false"
  91. class="pos-relative"
  92. @swiper="onHorizontalSwiper"
  93. >
  94. <SwiperSlide v-for="(item, index) in list" :key="index">
  95. <div class="text-left user-select">
  96. <div class="text-40px fw-800 text-#333 custom-title-font">
  97. {{ item.title }}
  98. </div>
  99. <div class="text-#999 mt-20px lh-24px">
  100. {{ item.description }}
  101. </div>
  102. <el-button class="!bg-#9B6CFF mt-40px !text-#fff !b-#9B6CFF w-160px !b-rd-380px text-16px fw-bold !h-40px px-20px" @click="openLoginModal">
  103. get started
  104. </el-button>
  105. </div>
  106. </SwiperSlide>
  107. </Swiper>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. <style lang="less" scoped>
  114. .user-select{
  115. user-select: none;
  116. }
  117. :deep(.block-right) {
  118. .swiper {
  119. position: relative;
  120. width: 100%;
  121. height: 100%;
  122. .swiper-slide {
  123. text-align: center;
  124. font-size: 18px;
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. }
  129. }
  130. }
  131. :deep(.block-left) {
  132. .swiper {
  133. width: 480px;
  134. height: 480px;
  135. }
  136. .swiper-slide {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. border-radius: 18px;
  141. font-size: 22px;
  142. font-weight: bold;
  143. color: #fff;
  144. }
  145. .swiper-pagination{
  146. top: unset;
  147. bottom: -80px;
  148. left: unset;
  149. right: -100px;
  150. display: flex;
  151. justify-content: end;
  152. }
  153. .swiper-slide:nth-child(1n) {
  154. background-color: rgb(206, 17, 17);
  155. }
  156. .swiper-slide:nth-child(2n) {
  157. background-color: rgb(0, 140, 255);
  158. }
  159. .swiper-slide:nth-child(3n) {
  160. background-color: rgb(10, 184, 111);
  161. }
  162. }
  163. </style>