<text>{{sons[0].gsons[0]._openid}}</text>取不到值
data如下:
sons:Array(1)
0:
gsons:Array(1)
0:{_id: "XJ4A2JT75u223hvj", _openid: "o4mgg0XJmnZjCjHOqfHnpjyGxtfk", isSeller: false, phone: "159****3703", pid: "o4mgg0bw14VjeUS_iInjr12hl7sE", …}
length:1
nv_length:(...)
__proto__:Array(0)
isSeller:false
pid:"o4mgg0XJmnZjCjHOqfHnpjyGxtfk"
userInfo:{avatarUrl: "https://wx.qlogo.cn/mmopen/vi_32/z4wepTcrcmEtyABhk…WocBU0eZqKvWKQrwz1T9kMrFxtxxgjbFFLRPKxxN5Oaew/132", city: "Jinhua", country: "China", gender: 1, language: "zh_CN", …}
_id:"XKR4nHffS3SWepQL"
_openid:"o4mgg0bw14VjeUS_iInjr12hl7sE"
是不是你写的有问题,这种问题最好能有个代码片段,这是我测试的代码片段。是没有问题的
https://developers.weixin.qq.com/s/IfsLcnmC787d
db.collection(
'users'
).where({
pid: app.globalData.openid
})
.get().then(res => {
console.log(res.data)
let sons = res.data
for
(let i = 0; i < res.data.length; i++) {
db.collection(
'users'
).where({
pid: res.data[i]._openid
})
.get().then(res1 => {
sons[i].gsons = res1.data
})
}
this
.setData({
sons: sons
})
})
这是data中的数据
这样看不出来。。。。最好能有代码片段