- setData函数怎么用啊?
const app = getApp() Page({ data: { t: [ '../img/00.jpg', '../img/01.jpg', ] } }) …… onLoad: function () { t: [ '../img/03.jpg', '../img/04.jpg', ] var temp = t; this.setData({ t: temp }) } 运行后老是提示以下错误: WAService.js:3 thirdScriptError t is not defined;at pages/index/index page lifeCycleMethod onLoad function ReferenceError: t is not defined …… 之前在这里提问过:https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=c71cd57f9c941a6baacbfee51e35ce7c&token=834490836&lang=zh_CN 搞这个函数搞了一个多星期了,都弄不明白,请哪位高手赐教!不胜感激!
2017-09-21 - 列表渲染,第二次渲染怎么写?
//js文件内容 Page({ data: { motto: 'Hello World', userInfo: {}, t: [ '../img/00.jpg', '../img/01.jpg', '../img/02.jpg', '../img/03.jpg', '../img/04.jpg', '../img/05.jpg', '../img/06.jpg', '../img/07.jpg', '../img/08.jpg', '../img/09.jpg', '../img/10.jpg', '../img/11.jpg', '../img/12.jpg', '../img/13.jpg', '../img/14.jpg', '../img/15.jpg', '../img/16.jpg', '../img/17.jpg', '../img/18.jpg', '../img/19.jpg', '../img/20.jpg', '../img/21.jpg', '../img/22.jpg', '../img/23.jpg', '../img/24.jpg', '../img/25.jpg', '../img/26.jpg', '../img/27.jpg', '../img/28.jpg', '../img/29.jpg', '../img/30.jpg', '../img/31.jpg', '../img/32.jpg', '../img/33.jpg' ] wxml文件内容 <scroll-view scroll-x style= "height: 1255rpx; width: 1750rpx;" > <image class="ys" wx:for="{{t}}" wx:for-item="t" src="{{t}}" > </image> </scroll-view> 这是初始化显示的内容 当数组t的内容改变后,第二次渲染要怎么写代码? this.setData({t}) 或者怎么改变t[]的内容?
2017-09-19