我在uniapp项目内引入使用百度地图javascriptAPI3.0
, 在获取用户位置的时候使用getCurrentPosition
方法并且判断getStatus() == BMAP_STATUS_SUCCESS
, 但是偶尔接口会返回none
, 已经校验了状态但是仍然会返回none
const location = new BMap.Geolocation();
// 开启sdk辅助定位
location.enableSDKLocation();
location.getCurrentPosition(function(res) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// 通过Geolocation类的getStatus()可以判断是否成功定位。
_this.point = res.point;
console.info(_this.point, "获取位置信息");
}
});
报错后我导致代码无法继续执行
Uncaught ReferenceError: none is not defined
我增加了辅助定位还是无效
// 开启sdk辅助定位
location.enableSDKLocation();
我想要搞清楚什么原因导致了成功状态下还返回none