目前我这边测试发现的问题
UNIAPP 获取定位的代码
在这里插入代码片
data的参数
data() {return {id: 0, // 使用 marker点击事件 需要填写idtitle: 'map',latitude: 39.909,longitude: 116.39742,covers: [{latitude: 39.909,longitude: 116.39742,width: 50,height: 50,iconPath: '../../static/drdingwei.png'}]}},
methods: 里面的方法
适用于百度地图精准定位
getLocation() {const that = this;uni.getLocation({type: 'gcj02', // 返回可以用于uni.openLocation的经纬度,默认为wgs84的gps坐标altitude: true, success: (res) => {console.log('当前位置的经度:' + res.longitude);console.log('当前位置的纬度:' + res.latitude);that.latitude = res.latitudethat.longitude = res.longitudethat.covers[0].latitude = res.latitudethat.covers[0].longitude = res.longitude},fail: (err) => {console.error('获取位置失败ÿ