今天需要在成图前从数据库依次获取各点的数据,结果发现直接用数组的forEach
和map
都无效。
代码如下:
//服务器异步方法总是最后?
configEchart=async()=>{
const {
stations} = this.state
let options = []
await stations.map(async(item,index)=>{
console.log(item,index)
await WorkSiteApi.getMeasuringData(item.measuringPointId)