欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mui 获取地图当前位置和经纬度

程序员文章站 2022-05-31 14:46:46
...

希望对大家有用,

mui.plusReady(function() {
    plus.geolocation.getCurrentPosition(MapPoint, function(e) {
         mui.toast("error:" + e.message);
         })
})

function MapPoint(position) {
    var Lon = position.coords.longitude;   //获取经度
    var Lat = position.coords.latitude;  //获取纬度
    var address = "当前地址:" + position.address.province + "," + position.address.city + "," + position.address.district + "," + position.address.street + "," + position.address.streetNum;
    alert(Lon + "," + Lat);
    alert(address);  
}

打包APK时,需要去百度或者高德申请appkey,这样打包后就不会出现获取不了地址的问题了。

mui 获取地图当前位置和经纬度

 

 

相关标签: mui