How to solve the problem that swiper cannot trigger in Wechat official account

            var mySwiper = new Swiper(".swiper-container-img", {
                autoplay: 2000,
                pagination: ".swiper-pagination-img",
                grabCursor: true,
                paginationClickable: true,
                onclick: function() {
                    console.log("click")
                },
                onslideChangeTransitionEnd: function () {
                    console.log("onslideChangeTransitionEnd")
                },
                ontouchMove: function () {
                    console.log("slideChangeTransitionEnd");
                    alert(1)
                },
            });
            
            
            
Mar.13,2021

check whether your swiper version is consistent with the version of the way you write it


swiper4 has been changed to:

on:{
    slideChangeTransitionEnd: function(){
      alert(this.activeIndex);//slide
    },
    touchMove: function(event){
      //
    }
}
For more information, please see API changes of Swiper4

Menu