微信小程序之滚动图片

1.用到的API

2.wxml

<view>
  <swiper class="swiper" autoplay="true" interval="2000" >
    <swiper-item>
      <image src="/images/post/xiaolong.jpg"></image>
    </swiper-item>
    <swiper-item>
      <image src="/images/post/vr.png"></image>
    </swiper-item>
    <swiper-item>
      <image src="/images/post/sls.jpg"></image>
    </swiper-item>

  </swiper>

</view>

  

3.wxss

/* pages/posts/post.wxss */
swiper {

width: 100%;
height: 600rpx;
}
swiper image{
width: 100%;
height: 600rpx;

}

  

4.设置路径

{
  "pages": [
    "pages/posts/post",
    "pages/welcome/welcome"
    
   
  ],
  "window": {
    "navigationBarBackgroundColor": "#b3d4db"
}
}

  

猜你喜欢

转载自www.cnblogs.com/liushisaonian/p/9496884.html