小程序的轮播图
<swiper autoplay="{{true}}" indicator-dots="{{true}}" indicator-active-color="rgb(255,10,10)" interval="1000" circular="{{true}}" > <swiper-item wx:for="{{img}}" wx:key="index"> <image src="/image/{{item}}"></image> </swiper-item> </swiper>
.wxss
.container{
width: 100%;
height: 150px;
}
swiper{
width: 100%;
}
swiper-item{
width: 100%;
height: 100%;
}
swiper-item image{
width: 96%;
height: 150px;
margin: 0 2%;
border-radius: 10px;
}
.js
Page({
data: {
img:["001.jpg","002.jpg","003.jpg"]
}
})
最后实现的样式


浙公网安备 33010602011771号