# 1.在index.wxml中添加以下代码
```
<view>
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrl}}" wx:key="index">
<swiper-item>
<image src="{{item.url}}" class="slide-image" />
</swiper-item>
</block>
</swiper>
</view>
```
# 2.在index.js中添加以下代码
```
Page({
data: {
imgUrl: [
{ url: "/images/post/cat.png" },//获取本地图片
{ url: "/images/post/crab.png" },
{ url: "/images/post/sls.png" },
],
indicatorDots: false,
autoplay: false,
interval: 5000,
duration: 1000
},
})
```