在manifest.json里面修改
"permission" : { "scope.userLocation": { "desc": "你的位置信息將用於小程序位置接口的效果展示" // 高速公路行駛持續后台定位 } }
在menthods使用
getLocation(success) { //打開外部地圖 uni.getLocation({ success(res) { console.log('定位1',res) uni.openLocation({ latitude: res.latitude, longitude: res.longitude, scale: 18 }) } }) },