wx:for不能动态绑定Page.data的值吗?比如
Page.data({
data_index:[0,1,2],
page0:{},
page1:{}
})
<view wx:for="{{data_index}}">
<view wx:for="{{“page”+index}}">
view>
想到了一个变通的方法
getUserCouponCodeList:function(e){
var that=this;
var status = e? e.currentTarget.dataset.status:0;
var page=this.data[“page”+status] || 0;
var changeData = {};
changeData[“status”] = status;
app.request({
url: ‘Coupon/getUserCouponCodeList’,
data: {
status: status,
page:page+1
},
success: function (res) {
if (res.data.status == 1) {
var couponCodeListStatus = that.data[“couponCodeList”+status] || [];
var result = res.data.data || [];
couponCodeListStatus = couponCodeListStatus.concat(result);
changeData[“couponCodeList” + status] = couponCodeListStatus;
changeData[“couponCodeList”] = couponCodeListStatus;
changeData[“page”+status] = page+1;
that.setData(changeData);
}
}
})
}