1.模板
<template name="stars">
<view>
<image src='/pages/img/{{item.star1[0]}}-star.png' style='width:15px;height:15px;'></image>
<image src='/pages/img/{{item.star1[1]}}-star.png' style='width:15px;height:15px;'></image>
<image src='/pages/img/{{item.star1[2]}}-star.png' style='width:15px;height:15px;'></image>
<image src='/pages/img/{{item.star1[3]}}-star.png' style='width:15px;height:15px;'></image>
<image src='/pages/img/{{item.star1[4]}}-star.png' style='width:15px;height:15px;'></image>
</view>
</template>
2.使用
<template is="stars" data="{{item}}" />
注意:在for循环里面使用模板,要传入json里面的值,传入item或者自己命名的值,不要传入item.lists等具体的值