// .wxml 文件中使用模版时 data 绑定的key <view class="demo-main"> <!-- 使用模版 通过data把数据传入 --> <template is="products" data="{{productsList : demo.products}}"> </template> </view> // 模版文件 tpl <template name="products"> <view class="products-box"> <block wx:for="{{productsList}}"> </block> </view> </template>
<import src="../tpls/demo/demo-tpl.wxml" />