效果(红色框):
紧接上话app.json的配置成功后,创建一个index文件夹在index.wxml中写下代码:
<view>
<swiper class="swiper_ways_one" indicator-dots="true"
autoplay="true"interval="1000" circular="true" style="height:{
{imgH}}">
<block wx:for="{
{swiperImgUrl}}"wx:key="*this"><!--"swiperImgUrl"为数组名 -->
<!-- *this 代表在 for 循环中的 item 本身,这种表示需要 item 本身是一个唯一的字符串或者数字 -->
<swiper-item >
<image src="{
{item}}" mode="widthFix" bindload="handleImgH"></image><!--"item(默认)为数组中的值,index(默认)为数组的索引" -->
</swiper-item>
</block>
</swiper>
</view>