在初始化swiper中加入这两个属性:
observer:true
observeParents:true
var swiper = new Swiper(‘.swiper-container‘, { pagination: ‘.swiper-pagination‘, paginationClickable: true, observer:true //修改swiper自己或子元素时,自动初始化swiper observeParents:true,//修改swiper的父元素时,自动初始化swiper });
时间: 2024-11-08 23:14:00