Vue-awesome-swiper: loop为true第一个slide被跳过,如何解决

Created on 9 Feb 2018  ·  7Comments  ·  Source: surmon-china/vue-awesome-swiper

``
swiperOption:{
observer: true,
observeParents: true,
loop:true,
pagination: {
el: '.swiper-pagination',
},
autoplay: {
delay: 2500,
disableOnInteraction: false
},
initialSlide:0,

},
``
数据是异步获取
输出this.$refs.mySwiper 和this.$refs.mySwiper.swiper两个对象的属性和方法,试了一下,都不太行,

Most helpful comment

数据变动时,靠 v-if 控制组件的渲染状态。

All 7 comments

数据变动时,靠 v-if 控制组件的渲染状态。

通过v-if判断是否拿到渲染列表用的数据,在拿到数据的时候在渲染swiper组件,亲测有效,我之前也是从最后一个直接跳到第二个

这个有一个问题,如果是渲染列表的 数据源 是动态改变的,比如随着筛选条件,列表的数据源会改变,这个时候重新渲染的列表,在点击的循环的时候会有问题。

而且加上v-if后,this.$refs.mySwiper 在computed 计算属性时,取不到值

@leobaixinxin 配合数据变动时的节点 + $nextTick 获取组件对象。

数据加载后才渲染swiper,我配置 direction: 'vertical',可以垂直滚动的同时,为什么还会加载水平的滚动

slidesPerView: 2

Was this page helpful?
0 / 5 - 0 ratings