当paginationRender 完成 给对应按钮做鼠标进入监听 模拟点击
swiperOptions: {
mousewheel: true,
slidesPerView: 'auto',
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
},
freeMode: true,
observer: true,
observeParents: true,
observeSlideChildren: true,
on: {
paginationRender: function() {
console.log('paginationRender')
const pages = document.getElementsByClassName('swiper-pagination-bullet')
for (let i = 0; i < pages.length; i++) {
pages[i].onmouseover = function(e) {
e.target.click()
}
}
}
},
pagination: {
el: '.swiper-pagination',
clickable: true,
renderBullet(index, className) {
return `<span class="${className} swiper-pagination-bullet-custom">${index + 1}</span>`
}
}
}