使用wx.onLocationChange 时,为什么位置没变 但会回调经纬度变化?
nLocation() {
var that = this
const _locationChangeFn = function(res) {
console.log('location change', res)
that.editSmallLocation(res.latitude, res.longitude)
}
wx.authorize({
scope: 'scope.userLocationBackground',
success: function (res) {
wx.startLocationUpdateBackground({
success: (res) => {
console.log(res);
wx.onLocationChange(_locationChangeFn)
},
})
},
fail: function (res) {
console.log(res);
wx.showModal({
content: '获取后台定位权限失败,请前往设置打开"使用小程序和离开小程序后"',
confirmText: '设置',
success(res) {
if (res.confirm) {
wx.openSetting()
} else if (res.cancel) {
wx.onLocationChange(_locationChangeFn)
}
}
})
},
})
},
这是wx.onLocationChange 返回的数据,手机一直没动,但是返回的经纬度有变化,打码的是相同的数据