async onGetLocation(datas){
let res = await Promise.all(datas.map(async (item) => {
return await this.convertFrom( [item.lon, item.lat])
}))
this.setState({
pathSimplifierData: res
})
}
convertFrom(point, type = 'gps') {
return new Promise((resolve, reject) => {
window.AMap.convertFrom(point,type, (status,result) => {
if(result.info === 'ok') {
resolve ( [result.locations[0].lng,result.locations[0].lat])
}
})
} )
}
https://blog.csdn.net/playboyanta123/article/details/99686853
网友评论