1.将轮播图区域里的代码填入
<!-- 轮播图区域 -->
<swiper>
<swiper-item>
<image></image>
</swiper-item>
</swiper>
2.在js里面放入需要的图片(名称)
3.定义轮播图的图片位置从哪里传入(wx:for=“?” 与data里的?:[ ]保持一致)
每一次的wx:for后跟随wx:key,不要漏了{{}}
4.将路径写入(图片此刻会显示)
widthFix为宽高比不变
5.加入轮播图样式
(不然会特别丑陋)
拓展
autoplay="true" 自动播放
indicator-dots="true" 显示指示点
indicator-active-color="#ee3f4d" 指示点颜色
interval="3000" 多少秒换一次
展示代码