1.编写以下代码(.wxml)
<!-- 轮播图结构 -->
<swiper class="swiper-contener" autoplay indicator-dots indicator-color="black" indicator-active-color="red">
<swiper-item>
<view class="item">A</view>
</swiper-item>
<swiper-item>
<view class="item">B</view>
</swiper-item>
<swiper-item>
<view class="item">C</view>
</swiper-item>
</swiper>
wxss添加以下样式
.swiper-contener{
height: 150px;
}
.item{
height: 100px;
line-height:150px;
text-align: center;
}
swiper-item:nth-child(1) .item{
height: 100%;
background-color: lightcoral;
}
swiper-item:nth-child(2) .item{
height: 100%;
background-color: rgb(173, 38, 78);
}
swiper-item:nth-child(3) .item{
height: 100%;
background-color: rgb(30, 207, 89);
}
2得到以下效果