1.wxml页面。
<view class="container">
<view class="page-body" style="width:100%; height: 500px; margin-top: -100px;">
<view class="page-section page-section-spacing swiper">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{background}}" wx:key="*this">
<swiper-item>
<image src="{{item}}" style="width:100%; height: 200px;"></image>
</swiper-item>
</block>
</swiper>
</view>
</view>
</view>
2.在js页面写入后端
background: ['/img/11111.webp', '/img/2222.webp', '/img/33333.webp', 'https://img1.baidu.com/it/u=3661236011,1315913336&fm=253&fmt=auto&app=138&f=JPEG?w=960&h=400'],
indicatorDots: true,
vertical: true,
autoplay: true,
interval: 2000,
duration: 500