微信小程序在插入輪播圖時需要用到swiper滑塊視圖容器,
swiper 里只能放置swiper-item(插槽)組件,否則會導(dǎo)致未定義的行為。
<view>
<image class="top-theme"
src="{{themeA.entrance_img}}"></image>
<swiper
class="swiper-img"
indicator-dots="{{true}}"
indicator-active-color="#157658"
circular
autoplay
interval="2000">
<block
wx:for="{{bannerB[0].items}}" wx:key="key">
<swiper-item>
<image class="swiper-img"
src="{{item.img}}"></image>
</swiper-item>
</block>
</swiper>
</view>
indicator-dots="{{true}}" :顯示面板指示點(diǎn)
indicator-active-color="#157658" :設(shè)置選中的指示點(diǎn)顏色
circular:循環(huán)輪播
autoplay:自動切換
interval="2000":自動切換間隔時間、
示例: