在.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中数据
item : {
background: ['../image/home_lunbo.png', '../image/home_lunbo.png', '../image/home_lunbo.png'],
},
-->