vue-awesome-swiper中loop设置true无效数据是动态加载的,在网上查不到和我相关的问题答案相关代码<div class="wrapper" :class="cname"> <swiper :options="options">
<swiper-slide v-for="(item, index) in items" :key="index">
<slot :src="item"></slot>
</swiper-slide>
<div class="swiper-pagination" v-if="options.pagination" slot="pagination"></div>
</swiper></div>name: "sliderComponent",props: { cname: { type: String, default: ""
}, options: { type: Object, default () { return { autoplay: { delay: 3000, disableOnInteraction: false, //stopOnLastSlide: false
}, loop: true, pagination: { el: '.swiper-pagination'
}, observeParents:true, observer:true
}
}
},不循环了,轮播到最后一个图就不动了
4 回答
Helenr
TA贡献1780条经验 获得超3个赞
<swiper :options="swiperOption" **ref="swiperOption"** > <swiper-slide v-for="(item, index) in items" :key="index"> <slot :src="item"></slot> </swiper-slide> <div class="swiper-pagination" v-if="options.pagination" slot="pagination"></div> </swiper>
在swiper上加上绑定ref="swiperOption"
data里
return{swiperOption:{ autoplay: { delay: 3000, disableOnInteraction: false, //stopOnLastSlide: false }, loop: true, pagination: { el: '.swiper-pagination' }, observeParents:true, observer:true }}
- 4 回答
- 0 关注
- 6352 浏览
添加回答
举报
0/150
提交
取消