数据取到了,前端页面没显示了,求大佬解答!
求大佬解答啊啊啊啊?//wxml {{item.name}} 删除 创建仓库 //JS Page({ /** * 页面的初始数据 */ data: { title:null, store_name:null, storeList:[], num:null, total:null, beachTimes:null, }, //获取仓库信息 getStoreList(){ const max_num = 20; db.collection('store').count().then(res=>{ console.log(res) this.setData({ total:res.total, }) this.setData({ beachTimes:Math.ceil(this.data.total/20) }) console.log(this.data.beachTimes) console.log(this.data.total) var list = []; for(let j = 0;j{ console.log(rez) for(let i = 0;i [图片] 问题已解决感谢各位大佬: wxml: <!--显示现有仓库--> <scroll-view scroll-y="true" class="showStore" style="height: 1000rpx;"> <block wx:for="{{storeList}}" wx:key="index"> <view class="name">{{item.store_name}}</view> <view class="delete" data-id="{{item._id}}" bindtap="delStore">删除</view> </block> </scroll-view> <!--提交表单--> <form action="submit" bindsubmit="createStore"> <input type="text" name="storename" placeholder="请输入仓库名称"/> <button class="createSt" bindtap="flashPage" type="primary" form-type="submit" >创建仓库</button> </form> JS: //获取仓库信息 getStoreList(){ const max_num = 20; db.collection('store').count().then(res=>{ console.log(res) this.setData({ total:res.total, }) this.setData({ beachTimes:Math.ceil(this.data.total/20) }) console.log(this.data.beachTimes) console.log(this.data.total) var list = [] var olddata = [] for(let j = 0;j<this.data.beachTimes;j++){ db.collection('store').skip(j*max_num).limit(max_num).get().then(ress=>{ olddata=ress.data list = olddata.concat(list) console.log(list) this.setData({ storeList:list }) }) } }) console.log('storeList是',this.data.storeList) }, 控制台: [图片]
2022-04-01