var _this = this
_this.watchId = plus.geolocation.watchPosition(function(position) {
let coords = position.coords;
let address = position.addresses
console.log("获取经纬度信息:", coords.longitude, coords.latitude)
console.log("获取地址信息:", address)
// console.log("返回id" ,plus.geolocation.watchPosition());
_this.checkAdress(coords.latitude, coords.longitude)
_this.longitude = coords.longitude;
_this.latitude = coords.latitude;
_this.dataForm.punchSite = coords.longitude + ',' + coords.latitude
//标记点赋值
_this.markers[0].longitude = coords.longitude;
_this.markers[0].latitude = coords.latitude;
//获取当前当前位置的名称
_this.locationcourier = address;
_this.dataForm.punchSiteName = _this.locationcourier
}, function(e) {
console.log("监听位置变化信息失败:" + e.message);
}, {
'enableHighAccuracy': true,
'geocode': true,
'provider': 'amap',
// 'maximumAge': 3000
});
获取的watchId 不是number 而是个类似于'timer13213123'的字符串,无法,怎么关都关不掉,哪怕退出后台都还在获取地址,打印plus.geolocation.clearWatch() 发现是个undefined ,我人都傻了,这个h5+到底是啥意思,不能用的东西放上来干啥 ,全是bug,有没有大佬遇到过的,给点建议
1 个评论
要回复文章请先登录或注册
强哥2023