情况一:
this.setData({
allList: this.data.allList.concat(temp),
})
this.setData({
orderList: this.data.allList
})
情况二:
this.setData({
allList: this.data.allList.concat(temp),
orderList: this.data.allList
})
w为啥情况一的orderList有数据,情况二的orderList无数据?
let allList = this.data.allList.concat(temp) // 1 this.setData({ allList }) this.setData({ orderList: allList }) // 2 this.setData({ allList, orderList: allList })
因为allList的值还没写入成功呀
let allList = this.data.allList.concat(temp)
this.setData({
allList,
orderList: allList
})
this.setData 是异步