5-3章节template无法实现,不知道错在哪里了。
来源:

我们刘长瑞
2016-12-19
代码1:posts.wxml
<import src="post-item/post-item-template.wxml" />
<view>
<swiper autoplay="auto" indicator-dots="true" interval="5000">
<swiper-item><image src="/images/post/xiaolong.jpg"></image></swiper-item>
<swiper-item><image src="/images/post/bl.png"></image></swiper-item>
<swiper-item><image src="/images/post/vr.png"></image></swiper-item>
</swiper>
<block wx:for="{{postList}}" wx:for-item="{{item}}" wx:fot-index="idx">
<template is="postItem" data="{{item}}" />
</block>
</view>
代码2:post-item-template.wxml
<template name="postItem">
<view class="post-container">
<view class="post-author-date">
<image class="post-author" src="{{item.avatar}}"></image>
<text class="post-date">{{item.date}}</text>
</view>
<text class="post-title">{{item.title}}</text>
<image class="post-image" src="{{item.imgSrc}}"></image>
<text class="post-content">{{item.content}}</text>
<view class="post-like">
<image class="post-like-image" src="/images/icon/view.png"></image>
<text class="post-like-font">{{item.collection}}</text>
<image class="post-like-image" src="/images/icon/chat.png"></image>
<text class="post-like-font">{{item.reading}}</text>
</view>
</view>
</template>
2回答
-
7七月
2016-12-19
出现模板无法显示,又没有任何错误,请从两个方面找原因。第一,模板的路径对不对。第二,数据绑定的变量是不是取值的时候不对。基本上是这两个问题。
00 -
慕粉2117253696
2017-01-07
遇到了同样的问题
012017-01-07
相似问题