腾讯地图获取当前用户位置的经纬度
<script charset="utf-8" src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=开发者key"></script>
<script>
var geolocation = new qq.maps.Geolocation("开发者key", "myapp");
// 定位成功之后调用的方法
function showPosition(position) {
let lat = position.lat;
let lng = position.lng;
console.log(lat);
console.log(lng);
};
function showErr() {
console.log('定位失败');
}
geolocation.getLocation(showPosition, showErr);
</script>腾讯地图获取当前定位的经纬度、地址的详细名称和地图上的显示
参考这篇文章:https://blog.csdn.net/lgysjfs/article/details/89475954?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase