getFalseDataLocations 函数体内没有 return,返回的是 undefined;写在 db.get.then 里面的 return 只是作为回调函数的返回值,不会变成 getFalseDataLocations 的返回值,应该这样写
that.getFalseDataLocations().then(markers => {
that.setData({
...
markers
})
})
getFalseDataLocations() {
return new Promise(resolve => {
...
db.collection...
.get().then(res => {
...
resolve(myMarker)
})
})
}