look at the picture
"" "" Promise
post a copy of the source code:
< html lang= "en" >
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
< / head >
< body >
<div id="container"></div>
< / body >
< script type= "text/javascript" >
var map = new BMap.Map("container");
var localSearch = new BMap.LocalSearch(map);
var address=["",""]
for(let i=0;i<address.length;iPP){
fn(i,function (d){
console.log(d)
})
}
function fn(i,callback){
var keyword = address[i];
localSearch.setSearchCompleteCallback(
function (searchResult) {
var poi = searchResult.getPoi(0);
var result = poi.point.lng + "," + poi.point.lat;
callback(result)
}
);
localSearch.search(keyword);
}
< / script >
< / html >