show.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. async function clickLogin() {
  14. try {
  15. const { status } = await openLoginModal()
  16. console.log('Login status:', status)
  17. // if (status)
  18. // 登陆后的逻辑
  19. }
  20. catch (error) {
  21. console.log(error)
  22. }
  23. }
  24. const swiperVertical = ref<any>(null)
  25. const swiperHorizontal = ref<any>(null)
  26. function onVerticalSwiper(swiper: any) {
  27. swiperVertical.value = swiper
  28. }
  29. function onHorizontalSwiper(swiper: any) {
  30. swiperHorizontal.value = swiper
  31. }
  32. function onSlideChange(swiper: any) {
  33. if (!swiperVertical.value)
  34. return
  35. swiperVertical.value.slideTo(swiper.realIndex)
  36. }
  37. function onSlideChange2(swiper: any) {
  38. if (!swiperHorizontal.value)
  39. return
  40. swiperHorizontal.value.slideTo(swiper.realIndex)
  41. }
  42. const list = ref([
  43. {
  44. title: 'Insight-Driven Creativity111',
  45. description:
  46. '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.',
  47. },
  48. {
  49. title: 'Insight-Driven Creativity22',
  50. description:
  51. '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.',
  52. },
  53. {
  54. title: 'Insight-Driven Creativity333',
  55. description:
  56. '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.',
  57. },
  58. ])
  59. onUnmounted(() => {
  60. if (swiperVertical.value) {
  61. swiperVertical.value.destroy()
  62. swiperVertical.value = null
  63. }
  64. })
  65. </script>
  66. <template>
  67. <div class="bg-#EAE5FA">
  68. <div class="w-1200-auto">
  69. <div class="flex justify-between ">
  70. <div class="w-50% block-left flex user-select justify-center items-center pr-100px">
  71. <Swiper
  72. :modules="modules"
  73. :mousewheel="false"
  74. :loop="true"
  75. effect="cards"
  76. :grab-cursor="true"
  77. :autoplay="{
  78. delay: 3000,
  79. disableOnInteraction: false,
  80. pauseOnMouseEnter: true,
  81. }"
  82. :pagination="{
  83. clickable: true,
  84. }"
  85. class="pos-relative"
  86. @slide-change="onSlideChange2"
  87. @swiper="onVerticalSwiper"
  88. >
  89. <SwiperSlide v-for="(item, index) in list" :key="index">
  90. Slide {{ index }}
  91. </SwiperSlide>
  92. </Swiper>
  93. </div>
  94. <div class="w-50% h-700px pos-relative block-right">
  95. <Swiper
  96. direction="vertical"
  97. :modules="modules"
  98. :mousewheel="false"
  99. :loop="true"
  100. :allow-touch-move="false"
  101. :pagination="false"
  102. class="pos-relative"
  103. @swiper="onHorizontalSwiper"
  104. >
  105. <SwiperSlide v-for="(item, index) in list" :key="index">
  106. <div class="text-left user-select">
  107. <div class="text-40px fw-800 text-#333 custom-title-font">
  108. {{ item.title }}
  109. </div>
  110. <div class="text-#999 mt-20px lh-24px">
  111. {{ item.description }}
  112. </div>
  113. <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="clickLogin">
  114. get started
  115. </el-button>
  116. </div>
  117. </SwiperSlide>
  118. </Swiper>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </template>
  124. <style lang="less" scoped>
  125. .user-select{
  126. user-select: none;
  127. }
  128. :deep(.block-right) {
  129. .swiper {
  130. position: relative;
  131. width: 100%;
  132. height: 100%;
  133. .swiper-slide {
  134. text-align: center;
  135. font-size: 18px;
  136. display: flex;
  137. justify-content: center;
  138. align-items: center;
  139. }
  140. }
  141. }
  142. :deep(.block-left) {
  143. .swiper {
  144. width: 480px;
  145. height: 480px;
  146. }
  147. .swiper-slide {
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. border-radius: 18px;
  152. font-size: 22px;
  153. font-weight: bold;
  154. color: #fff;
  155. }
  156. .swiper-pagination{
  157. top: unset;
  158. bottom: -80px;
  159. left: unset;
  160. right: -100px;
  161. display: flex;
  162. justify-content: end;
  163. }
  164. .swiper-slide:nth-child(1n) {
  165. background-color: rgb(206, 17, 17);
  166. }
  167. .swiper-slide:nth-child(2n) {
  168. background-color: rgb(0, 140, 255);
  169. }
  170. .swiper-slide:nth-child(3n) {
  171. background-color: rgb(10, 184, 111);
  172. }
  173. }
  174. </style>