思路先通过uni.getLocation()获取当前位置,然后uni.chooseLocation()通过这个函数进行地图选点
代码
mapSelect() { const that = this uni.getLocation({ type: 'wgs84', success: function(res) { uni.chooseLocation({ latitude: res.latitude, longitude: res.longitude, success: function(res) { console.log(res.address) console.log(res.name) console.log(res.latitude) //维度 console.log(res.longitude) //经度 }, fail(err) { console.log(err) }, complete(a) { console.log(a) } }); } }); },