背景:未引入高德百度腾讯地图,但需要获取当前位置
解决方法:
使用 html5plus
www.html5plus.org/doc/zh\_cn/…
plus.geolocation.getCurrentPosition(function(p){
console.log('Geolocation\nLatitude:' + p.coords.latitude + '\nLongitude:' + p.coords.longitude + '\nAltitude:' + p.coords.altitude);
console.log(p)
}, function(e){
uni.showToast({
title: "请确认是否打开定位!",
icon: 'none',
duration: 3000
})
},{
provider:"system",
coordsType:"wgs84"
}
);