我们在用小程序写一个项目时,首页往往是以轮播图的形式展现的。那么我们该怎么实现轮播图的播放呢,直接在wxml文件里写就可以啦,可以自己在wxss里加一些自己喜欢的样式哦。navigator 是用来实现跳转页面的,(不能删除!!!)open-type=“switchTab” 是指跳转定义在tabbar里面的页面
index.wxml文件
<view class="swiper_top">
<swiper class="swiper_body" autoplay="true" indicator-dots="true"
indicator-color="#646464" indicator-active-color="#ffffff" interval="2000"
circular="true">
<swiper-item class="swiper_item_body">
<navigator url="/pages/district/statisticalquery/statisticalquery" open-type="switchTab">
<image class="swiper_image" src="/images/noImage.png" mode="widthFix"></image>
</navigator>
</swiper-item>
<swiper-item class="swiper_item_body">
<image class="swiper_image" src="/images/add-picture.png" mode="widthFix"></image>
</swiper-item>
<!-- <swiper-item class="swiper_item_body">
<image class="swiper_image" src="/images/del.png" mode="widthFix"></image>
</swiper-item> -->
</swiper>
</view>