在.wxml頁面中用impor標簽引用。


<template name="lunbo_template">
? ? <swiper class="home_swiper" indicator-dots="ture" indicator-active-color="#fff"?autoplay="true"?>
? ? <block wx:for="{{background}}" wx:key="*this">
? ? ? ? ? <swiper-item>
? ? ? ? ? ? <image src="{{item}}" mode="widthFix" width="750"></image>
? ? ? ? ? </swiper-item>
? ? </block>
? </swiper>
</template>
<!--
swiper標簽中的屬性通過微信提供的屬性都可以增刪改;
? /*輪播圖樣式*/
.home_swiper{
? width: 100%;
}
.home_swiper image{
? width: 100%;
}
js文件中data中數(shù)據(jù)
item : {
? ? ? background: ['../image/home_lunbo.png', '../image/home_lunbo.png', '../image/home_lunbo.png'],
? ? },
-->