<div class="swiper-container swiper-init travel-index-swiper"> <div class="swiper-wrapper"> <div class="swiper-slide"> <img src="../../images/pic1.jpg" height="100" /> </div> <div class="swiper-slide"> <img src="../../images/pic2.jpg" height="100" /> </div> <div class="swiper-slide"> <img src="../../images/pic3.jpg" height="100" /> </div> </div> <div class="swiper-pagination travel-index-swiper-pagination"></div> </div>
JS:
var mySwiper = new Swiper('.travel-index-swiper', { autoplay: { delay: 2500, }, pagination: { el: '.travel-index-swiper-pagination', clickable: true } });
总结:和v1.6的写法还是差异很大的,是实例化的格式上