getLocation:fail auth deny
简述
在小程序获取当前位置经纬度时,报错 getLocation:fail auth deny
获取代码
getNowPosition(){
// 获取当前的地理位置
var that = this
console.log(888);
wx.getLocation({
type: 'gcj02',
success: function (res) {
//赋值经纬度
that.setData({
latitude: res.latitude,
longitude: res.longitude,
})
console.log('经度',res.longitude);
console.log('纬度',res.latitude);
},
fail: function (errInfo) {
console.info(errInfo,8889)
}
})
},
原因
微信定位没有打开造成的
解决
按照以下步骤打开即可