|
|
|
@ -12,13 +12,13 @@ |
|
|
|
watch-overflow |
|
|
|
observe-parents |
|
|
|
:space-between="16" |
|
|
|
:autoplay="{ delay: 30000 }" |
|
|
|
:autoplay="{ delay: 30000, disableOnInteraction: false }" |
|
|
|
observe-slide-children |
|
|
|
:modules="modules" |
|
|
|
class="h-[1776px] py-5" |
|
|
|
@swiper="swiperInit" |
|
|
|
> |
|
|
|
<SwiperSlide v-for="item of customerList" :key="item.proposalCode"> |
|
|
|
<SwiperSlide v-for="item of customerList" :key="item.proposalCode" :class="noSwiping ? 'swiper-no-swiping' : ''"> |
|
|
|
<ListItem :customer="item" /> |
|
|
|
</SwiperSlide> |
|
|
|
</Swiper> |
|
|
|
@ -33,7 +33,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { shallowRef } from 'vue' |
|
|
|
import { onBeforeUnmount, ref, shallowRef } from 'vue' |
|
|
|
import ListItem from '../ListItem/ListItem.vue' |
|
|
|
import { Autoplay } from 'swiper/modules' |
|
|
|
import { Swiper, SwiperSlide } from 'swiper/vue' |
|
|
|
@ -53,11 +53,32 @@ const swiper = shallowRef() |
|
|
|
function swiperInit(_swiper: any) { |
|
|
|
swiper.value = _swiper |
|
|
|
} |
|
|
|
let timer: number |
|
|
|
const noSwiping = ref(false) |
|
|
|
const TIMEOUT = 3000 |
|
|
|
function disable() { |
|
|
|
noSwiping.value = true |
|
|
|
swiper.value?.autoplay?.stop() |
|
|
|
} |
|
|
|
function enable() { |
|
|
|
timer && clearTimeout(timer) |
|
|
|
timer = setTimeout(() => { |
|
|
|
noSwiping.value = false |
|
|
|
swiper.value?.autoplay?.start() |
|
|
|
}, TIMEOUT) |
|
|
|
} |
|
|
|
|
|
|
|
function scroll() { |
|
|
|
swiper.value?.slideTo(0) |
|
|
|
} |
|
|
|
|
|
|
|
window.addEventListener('touchmove', disable) |
|
|
|
window.addEventListener('touchend', enable) |
|
|
|
|
|
|
|
onBeforeUnmount(() => { |
|
|
|
window.removeEventListener('touchmove', disable) |
|
|
|
window.removeEventListener('touchend', enable) |
|
|
|
}) |
|
|
|
defineExpose({ |
|
|
|
scroll |
|
|
|
}) |
|
|
|
|