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,这样打包后就不会出现获取不了地址的问题了。
上一篇: 如何减肚子上的赘肉 七个瑜伽招式抚平小腹
下一篇: 如何应用已有的样式