swiper.js 循环模式下索引不正确的解决方法

根据文档,我获取 swiper 当前索引值用的是activeIndex
swiper.on('slideChangeTransitionEnd', function () {
console.log('swiper当前索引:',swiper.activeIndex);
}
但是在swiper配置了loop:true ,开启循环之后,索引 打印出来是错的...
在循环模式下,获取索引要通过realIndex,
console.log('swiper当前索引:',swiper.realIndex); // loop 模式下 realIndex
版权声明:
作者:东明兄
链接:https://blog.crazyming.com/note/785/
来源:CrazyMing
文章版权归作者所有,未经允许请勿转载。


匿名
东明兄@匿名