快捷导航

h5获取经纬度有问题

functionjustify_location(){if(navigator.geolocation){//支持console.log("支持地理位置接口");}else{//不支持console.log("不支持地理位置接口");}}functionagree_obtain_location(){varoption={enableHighAccuracy:true,timeout:Infinity,maximumAge:0};navigator.geolocation.getCurrentPosition(geoSuccess,geoError,option);}functiongeoSuccess(event){console.log(event.coords.latitude+','+event.coords.longitude);lat=event.coords.latitude;lng=event.coords.longitude;console.log(lat,lng)}functiongeoError(event){console.log("Errorcode"+event.code+"."+event.message);}justify_location();agree_obtain_location();用这个方法,不稳定,有时候可以,有时候不行,打包成app也不可以了,请问有什么好的稳定的方法呢~~?

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员2

调百度地图接口
回复

使用道具 举报

调百度地图接口
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP