Amap is referenced in vue to render data points with markerList. How to insert an asynchronous operation in getInfoWindow?
ordinary words show a pop-up window like this:
initMarkerList() {
let _this = this;
map.clearMap();
AMapUI.loadUI(["misc/MarkerList", "overlay/SimpleInfoWindow"], function(
MarkerList,
SimpleInfoWindow
) {
var markerList = new MarkerList({
//
getInfoWindow: function(data, context, recycledInfoWindow) {
let $data = data.extData;
let str = ``;
_this.$http
.post(_this.page.root + "Cleandot/QueryCleandotModel", {
ID: $data["ID"]
})
.then(data => {
str = `test`;
})
.then(() => {
//
if (recycledInfoWindow) {
recycledInfoWindow.setInfoTitle($data["Name"]);
recycledInfoWindow.setInfoBody(str);
return recycledInfoWindow;
}
return new SimpleInfoWindow({
infoTitle: $data["Name"],
infoBody: str,
offset: new AMap.Pixel(0, -20)
});
});
}
});
markerList.render(_this.markers);
});
},
I am very rusty asynchronously. Please give me some advice.