<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&akhLzWo0VsyW7dGUD5BGaj5xlC4i4a0lKl"></script>
<script type="text/javascript">
function bd_position() { //百度定位
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r){
if(this.getStatus() == BMAP_STATUS_SUCCESS){
console.log(r.address);debugger;
}
else {
console.log('failed');
}
},{enableHighAccuracy: true})
}
</script>
有一半的几率都返回空的对象,有几率又有结果,这样用不了...
问题是这个是什么鬼?
如果这个是判断成功的话那为什么会返回一个空的?
this.getStatus() == BMAP_STATUS_SUCCESS //????
返回的结果
Object {city: "", city_code: 0, district: "", province: "", street: ""…}
city
:
""
city_code
:
0
district
:
""
province
:
""
street
:
""
street_number
:
""