获取获取当前位置信息.
Jinxishihenian opened this issue · 3 comments
Jinxishihenian commented
没有找到获取当前位置的API
jaywcjlove commented
https://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b40
//获取当前位置
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r){
if(this.getStatus() == BMAP_STATUS_SUCCESS){
mk = new BMap.Marker(r.point);
getAddress(r.point);
}else {
alert('failed'+this.getStatus());
}
});
Jinxishihenian commented
这个库,提供这个服务吗?
类似于
https://lbsyun.baidu.com/index.php?title=jspopularGL/guide/geoloaction
https://uiwjs.github.io/react-amap/#/geolocation
如果我安装官方文档的用法的话,需要将BMap对象,挂载到windows对象上.
Jinxishihenian commented
又翻了下文档,这个BMap对象已经挂载到windows对象上了,这么晚,谢谢了.
https://uiwjs.github.io/react-baidu-map/#/api-loader