已经得到解决了,谢谢大家。
template模板无法获取{{}}绑定数据显示在页面上,后台也没有报错。- 当前 Bug 的表现(可附上截图) [图片] template模板部分 [图片] 页面调用模板部分 [图片] JS部分 [图片] 数据部分。 - 预期表现 页面显示信息 - 实际情况 模板中{{}}的数据均无法显示 后台也没有报错信息。 - 复现路径 - 提供一个最简复现 Demo posts.wxml <import src="post-itme/post-itme-template.wxml" /> <view> <swiper vertical='{{false}}' indicator-dots="true" autoplay="true" interval='3000'> <swiper-item> <image src="/images/avatar.jpg"></image> </swiper-item> <swiper-item> <image src="/images/avatar.jpg"></image> </swiper-item> <swiper-item> <image src="/images/avatar.jpg"></image> </swiper-item> </swiper> <block wx:for="{{key}}" wx:for-item="itme" wx:for-index="idx"> <template is="postItem" data="{{...item}}"/> </block> </view> post-itme-template.wxml <template name="postItem"> <view class="post-container"> <view class="post-author-date"> <image class="post-author" src="{{avatar}}"></image> <text class="post-date">{{date}}</text> </view> <text class="post-title">{{title}}</text> <image class="post-image" src="{{imgSrc}}"></image> <text class="post-content">{{content}} </text> <view class="post-like"> <image class="post-like-image" src="/images/avatar.jpg"></image> <text class="post-like-font">{{collection}}</text> <image class="post-like-image" src="/images/avatar.jpg"></image> <text class="post-like-font">{{reading}}</text> </view> </view> </template> posts.js var postsDate = require("../../data/posts-data.js"); Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // this.data.postList = postsData.postList this.setData({ key: postsDate.postList }); }, }) posts-data.js var local_database = [ { date: "Sep 18 2016", title: "正是霞飞卸妆时", imgSrc: "/images/avatar.jpg", avatar: "/images/avatar.jpg", img_condition: true, content: "每一个小程序页面也可以使用.json文件来对本页面的窗口表现进行配置。页面的配置只能设置 app.json.中部分 window ", reading: "112", collection: "96", }, { date: "Sep 3 2056", title: "正萨科技等你", imgSrc: "/images/avatar1.jpg", avatar: "/images/avatar1.jpg", img_condition: true, content: "每一个小程序页面也可以使用.json文件来对本页面的窗口表", reading: "563", collection: "16", }, { title: "微信小程序开发安装工具指南", content: "每一个小程序页面也可以使用.json文件来对本页面的窗口表", imgSrc: "/images/avatar1.jpg", reading: "563", collection: "16", date:"Nov 20 2016", avatar: "/images/avatar1.jpg", img_condition: true, } ] module.exports = { postList: local_database } 如有能帮解决的大神请附上支付宝账号 小弟不胜感激
2018-12-19