hjyd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
3.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="header_container">
  3. <swiper
  4. :pagination="pagination"
  5. :modules="modules"
  6. :virtual="true"
  7. :spaceBetween="0"
  8. :loop="true"
  9. @swiper="onSwiper"
  10. @slideChange="onSlideChange"
  11. :keyboard="{
  12. enabled: true,
  13. onlyInViewport: false,
  14. pageUpDown: true,
  15. }"
  16. @autoplayTimeLeft="onAutoplayTimeLeft"
  17. class="header_swiper"
  18. >
  19. <swiper-slide :virtualIndex="1">
  20. <SlideFive />
  21. </swiper-slide>
  22. <swiper-slide :virtualIndex="2">
  23. <SlideTwo />
  24. </swiper-slide>
  25. <swiper-slide :virtualIndex="3">
  26. <SlideOne />
  27. </swiper-slide>
  28. <swiper-slide :virtualIndex="4">
  29. <SlideFour />
  30. </swiper-slide>
  31. <swiper-slide :virtualIndex="5">
  32. <SlideThree />
  33. </swiper-slide>
  34. <template #container-end>
  35. <div class="autoplay-progress">
  36. <svg viewBox="0 0 48 48" ref="progressLine">
  37. <line x1="-200" y1="2" x2="300" y2="2"></line>
  38. </svg>
  39. </div>
  40. </template>
  41. </swiper>
  42. <div class="down_circle" @click="toNext">
  43. <img
  44. :src="Arrow"
  45. alt="arrow"
  46. class="arrow animate__animated animate__heartBeat animate__infinite animate__slower"
  47. />
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. // :autoplay="{
  53. // delay: 5000,
  54. // disableOnInteraction: false,
  55. // }"
  56. import { useSwiperStore } from '@/store'
  57. // Import Swiper Vue.js components
  58. import { Swiper, SwiperSlide } from 'swiper/vue'
  59. // Import Swiper styles
  60. import 'swiper/css'
  61. // import required modules
  62. import { Pagination, Autoplay, Keyboard, Virtual } from 'swiper'
  63. import { ref } from 'vue'
  64. import SlideOne from './SlideOne'
  65. import SlideTwo from './SlideTwo'
  66. import SlideThree from './SlideThree'
  67. import SlideFour from './SlideFour'
  68. import SlideFive from './SlideFive'
  69. import Arrow from '@/assets/img/banner/arrow.png'
  70. export default {
  71. components: {
  72. Swiper,
  73. SwiperSlide,
  74. SlideOne,
  75. SlideTwo,
  76. SlideThree,
  77. SlideFour,
  78. SlideFive,
  79. },
  80. methods: {
  81. toNext() {
  82. const swiperStore = useSwiperStore()
  83. swiperStore.slideTo(1)
  84. },
  85. onSwiper(swiper) {},
  86. onSlideChange(swiper) {
  87. const swiperStore = useSwiperStore()
  88. const { activeIndex } = swiper
  89. swiperStore.updateHeaderIndex(activeIndex)
  90. },
  91. },
  92. setup() {
  93. const progressLine = ref(null)
  94. const onAutoplayTimeLeft = (s, time, progress) => {
  95. progressLine.value.style.setProperty('--progress', 1 - progress)
  96. }
  97. return {
  98. onAutoplayTimeLeft,
  99. progressLine,
  100. Arrow,
  101. pagination: {
  102. clickable: true,
  103. renderBullet: function (index, className) {
  104. return '<div class="' + className + '"></div>'
  105. },
  106. },
  107. modules: [Pagination, Autoplay, Keyboard, Virtual],
  108. }
  109. },
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. .header_container {
  114. width: 100%;
  115. height: 100%;
  116. position: relative;
  117. min-width: 1668px;
  118. background: #000;
  119. .down_circle {
  120. position: absolute;
  121. bottom: 67px;
  122. left: 50%;
  123. transform: translate(-50%);
  124. width: 28px;
  125. height: 28px;
  126. border: 2px solid #ffffff;
  127. z-index: 11;
  128. border-radius: 50%;
  129. cursor: pointer;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. .arrow {
  134. width: 12px;
  135. height: 8px;
  136. }
  137. }
  138. }
  139. </style>