你好,我这边有一个关于异步的问题。 var point_hz = null;
var point_bj = null;
var point_sh = null;
plus.maps.Map.geocode("杭州", {
city: "杭州"
}, function(e) {
point_hz = new plus.maps.Point (JSON.stringify(e.coord));
alert(point_hz);
}, function(e) {
alert(JSON.stringify(e));
});
plus.maps.Map.geocode("北京", {
city: "北京"
}, function(e) {
point_bj = new plus.maps.Point (JSON.stringify(e.coord));
}, function(e) {
});
plus.maps.Map.geocode("上海", {
city: "上海"
}, function(e) {
point_sh = new plus.maps.Point (JSON.stringify(e.coord));
}, function(e) {
alert(JSON.stringify(e));
});
var polyLine = new plus.maps.Polyline(new Array(point_hz, point_bj, point_sh));
alert(point_bj);
polyLine.setLineWidth(2);
polyLine.setStrokeColor("#ff0000");
ptMap.addOverlay(polyLine);
这个方法中,在下方获取的3个点全是null值,有什么方法可以暂时关闭异步吗?
0 个回复