小程序的轮播图



<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"]
   }
})

  最后实现的样式

 

posted @ 2021-03-15 23:14  大鱼&小鱼  阅读(35)  评论(0编辑  收藏  举报