- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
请问 遇到这个问题怎么办? 我获取地址的的时候 报错
if (wx.chooseAddress) {
console.log(’+++++++++++++++’)
wx.chooseAddress({
success: function (res) {
console.log(res)
that.setData({
addr: {
name: res.userName,
mobile: res.telNumber,
address: res.provinceName + res.cityName + res.countyName + res.detailInfo,
zip: res.postalCode,
type: ‘默认’,
flag: true
},
})
wx.setStorage({
key: ‘addr’,
data: that.data.addr,
})
},
fail: function (err) {
console.log(err)
wx.getSetting({
success(res) {
if (!res.authSetting[‘scope.address’]) {
console.log(res)
wx.openSetting({
})
} else {
wx.chooseAddress({
success: function (res) {
console.log(res)
that.setData({
addr: {
name: res.userName,
mobile: res.telNumber,
address: res.provinceName + res.cityName + res.countyName + res.detailInfo,
zip: res.postalCode,
type: ‘默认’,
flag: true
},
})
wx.setStorage({
key: ‘addr’,
data: that.data.addr,
})
}
})
}
},
fail(res) {
console.log(‘调用失败’)
}
})
}
})
} else {
console.log(‘当前微信版本不支持chooseAddress’);
}