|
swiper 版本 "swiper": "^5.4.5",
[size=13.0667px]vue-awesom-swiper 版本 "vue-awesome-swiper": "^4.1.1",
滑动时改变下标 在页面从新渲染 会停顿3-4秒
<template>
<div>
<swiper ptions="swiperOption" ref="mySwiper">
<swiper-slide class="swiper-slide" v-for="(item,index) in resultitems" :key="index">
<div style="width: 100%;height: 500px;">aa</div>
<div>{{current_index}}</div>
</swiper-slide>
</swiper>
</div>
</template>
<script>
import {Swiper, SwiperSlide} from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
export default {
name: "TestSwiper.vue",
data() {
let that=this;
return {
resultitems: [],
current_index:0,
swiperOption: {
longSwipesRatio: 0.1,
disableOnInteraction: false,
loop: false,
autoplayDisableOnInteraction: false,
// 如果需要分页器
pagination: '.swiper-pagination',
// 如果需要前进后退按钮
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
// 如果需要滚动条
scrollbar: '.swiper-scrollbar',
swipeToNext: false,
swipeToPrev: false,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
observer: false,
observeParents: false,
runCallbacksOnInit: false,
on: {
slideChangeTransitionStart: function () {
// let index=this.activeIndex;
// that.setIndex();
that.current_index=this.realIndex;
},
}
},
}
},
components: {
Swiper,
SwiperSlide
},
computed: {
swiper() {
return this.$refs.mySwiper.swiper;
}
},
created() {
for (let i = 0; i < 100; i++) {
this.resultitems = i;
}
}
}
</script>
|
|