$api.request('接口', 'POST', 参数, res => {
res.content.forEach(item => {
item.imageUrl = this.data.imgUrl + JSON.parse(JSON.parse(item.content).icon)[0]
$api.request('接口','GET',参数,resp=>{
item.shoopName= resp.data.name
})
})
this.setData({
orderList:res.content
})
console.log(this.data.orderList)
})
通过接口获取到想要的数组res.content,向res.content数组里面每一个对象添加一个shoopName字段和imageUrl字段,然后赋值给orderList,
最后在wxml中遍历orderList,imageUrl字段显示成功,但是shoopName字段没成功。这是为什么?求解!