如何使分页正常显示应该是01 02 03 04 05 06 07 08 09 10等t,e 20 30 40
var swiper = new Swiper(".mySwiper", {
slidesPerView: 3,
spaceBetween: 30,
pagination: {
el: '.swiper-pagination',
clickable: true,
renderBullet: function (index, className) {
return '<span class="' + className + '">' + "0" + (index + 1) + "</span>";
},
},
});
.swiper {
width: 100%;
height: 500px
}
.swiper-wrapper{
padding-bottom: 50px;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
background-color: red;
height: 200px;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.swiper-pagination-bullet {
color: #18918a;
}
.swiper-pagination-bullet-active {
color: #222;
}
.swiper-pagination-bullet-active::after {
opacity: 1;
}
.swiper-pagination-bullet-active {
padding-right: 82px;
background-color: transparent;
position: relative;
}
.swiper-pagination-bullet::after {
content: "";
position: absolute;
top: 50%;
left: 33px;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
width: 54px;
border-bottom: 1px solid #fff;
opacity: 0;
-webkit-transition: 0.5s all;
-o-transition: 0.5s all;
transition: 0.5s all;
}
.swiper-pagination-bullet {
font-size: 14px;
line-height: 100%;
font-family: "Onest-Regular";
background-color: transparent !important;
opacity: 1;
height: 14px;
position: relative;
-webkit-transition: 0.5s all;
-o-transition: 0.5s all;
transition: 0.5s all;
width: 10px;
z-index: 10;
}
.common-pagination {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 100%;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
gap: 8px;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
top: 0 !important;
}
<link href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div>
<div class="swiper-slide">Slide 7</div>
<div class="swiper-slide">Slide 8</div>
<div class="swiper-slide">Slide 9</div>
<div class="swiper-slide">Slide 10</div>
<div class="swiper-slide">Slide 11</div>
</div>
<div class="swiper-pagination common-pagination"></div>
</div>