post the code:
html:
<section class="pc-banner">
<div class="swiper-container">
<div class="swiper-wrapper" >
<div v-for="( item,index ) in bannerList" :key="index" class="swiper-slide swiper-no-swiping" style="cursor:pointer;">
<img :src="item.serviceImg">
<!-- <div class="layer-mask" @click="btnBanner(item)" ></div> -->
</div>
</div>
<div class="button">
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
</div>
<!-- <div class="swiper-pagination"></div> -->
</section>
data:
return{
bannerList: [],
}
declare swiper:
initSwiper () {
console.log(this);
var _this = this;
var swiper = new Swiper(".swiper-container",{
autoplay: false,
autoplayStopOnLast: true,
speed:1500,
autoplayDisableOnInteraction: false,
loop: true,
noSwiping:true,
centeredSlides: true,
slidesPerView: 2,
pagination: ".swiper-pagination",
paginationClickable: true,
prevButton: ".swiper-button-prev",
nextButton: ".swiper-button-next",
onClick: function(swiper,e){
console.log(swiper.activeIndex,e.target,"Swiper",_this.btnBanner(swiper.activeIndex));
},
preventLinksPropagation: false, //
onInit: function(swiper) {
console.log(swiper.slides[2].className)
swiper.slides[2].className = "swiper-slide swiper-slide-active";
},
breakpoints: {
668: {
slidesPerView: 1,
}
}
});
}