//data是一个服务器返回的数组,然后套在一个for循环里面
for(var i = 0; i < data.length; i++) {
var s,d;
var y = data[i].positionY;
var x = data[i].positionX;
var point = new plus.maps.Point(y, x);
var nowpoint = new plus.maps.Point(lng, lat);
plus.maps.Map.calculateDistance(point, nowpoint, function(event) {
var dis = event.distance / 1000;
s = dis.toFixed(2);
//这里打印 s 有值
});
plus.maps.Map.reverseGeocode(point, {
coordType: "gcj02"
}, function(event) {
d = event.address;
//这里打印 d有值
});
//这里打印 s,d 没值 都是undfine未定义
}
跪求大神指引, 我这个是通过 服务器返回的坐标建立旧的point,将用户的坐标nowpoint,分别通过H5+的静态方法获取距离和反推坐标地址。就是拿不到值,急 求解答 谢谢!
1***@qq.com
请问你现在解决这个问题了吗?、
2017-11-23 21:15