原来只要data里数据赋值失败或者说是undefined都会不执行啊
setData不执行?// onload函数调用此函数 getId: function(i,tmpItems){ if(i == 2) return; var that = this; if(i == 0){ var tmpArr = []; db.collection('video').skip(i*20).get({ success:function(res) { for (let j = 0; j < res.data.length; j++) { tmpArr.push(res.data[j]) } that.getId(i+1,tmpArr) } }) }else { var screenHeight = wx.getSystemInfoSync().windowHeight; db.collection('video').skip(i*20).get({ success:function(res) { var tempItems1 = []; for (let j = 0; j < res.data.length; j++) { tempItems1.push(res.data[j]) } // 下面setData为什么不执行 that.setData({ scrollHeight: screenHeight, items: tempItems1.length == 20 ? tmpItems.concat(tempItems1) : tempItems1.concat(tmpItems), videoUrl:totalItems[0].video, }) } }) }
2021-06-09