const longitude = 123;
const latitude = 12;
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userLocation']) {
var that = this
wx.openSetting({
success (res) {
if(res.authSetting["scope.userLocation"]) {
wx.getLocation({
type: 'wgs84', // gcj02返回可以用于wx.openLocation的经纬度
success: function (res) {
wx.openLocation({ //使用微信内置地图查看位置。
longitude: longitude, //要去的经度-地址
latitude: latitude, //要去的纬度-地址
// name: that.data.companyInfo.locusname,//地名
// address: that.data.companyInfo.address //简介
})
}
})
}else {
wx.showToast({
title: '请授权',
})
}
}
})
} else {
wx.getLocation({
type: 'wgs84', // gcj02返回可以用于wx.openLocation的经纬度
success: function (res) {
wx.openLocation({ //使用微信内置地图查看位置。
longitude: longitude, //要去的经度-地址
latitude: latitude, //要去的纬度-地址
// name: that.data.companyInfo.locusname,//地名
// address: that.data.companyInfo.address //简介
})
}
})
}
}
})
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
app.json文件已添加以下代码也失效
"permission": { "scope.userLocation": { "desc": "你的位置信息将用于小程序位置接口的效果展示" } }