-在开发者工具调取地址信息时(wx.chooseAddress)报错
当前 Bug 的表现(可附上截图)
VM233:1 appServiceSDKScriptError
Cannot read property 'mode' of undefined;at api onAppEnterBackground callback function
TypeError: Cannot read property 'mode' of undefined
at Bt.
(http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:525987)
at Bt.emit (http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:305615)
at Object.emit (http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:324480)
at Bt. (http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:330528)
at Bt.emit (http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:305657)
at Object.emit (http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:324480)
at http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:325658
at http://127.0.0.1:13823/appservice/__dev__/WAService.js:1:262652
at e (http://127.0.0.1:13823/appservice/appservice?t=1547297845026:1598:2640)
at n.registerCallback.t (http://127.0.0.1:13823/appservice/appservice?t=1547297845026:1598:2903)
- 预期表现
不应报错
- 复现路径
- 提供一个最简复现 Demo
chooseAddress:function(){
var that = this
wx.chooseAddress({
success:function(res){
var trade_addr =
res.provinceName +
res.cityName +
res.countyName +
res.detailInfo+" "
res.userName+"收 "
"电话:" + res.telNumber
"邮编:" + res.postalCode
var buyerInfoStr = "{" +
"\"userName\":\"" + res.userName + "\"," +
"\"postalCode\":\"" + res.postalCode + "\"," +
"\"provinceName\":\"" + res.provinceName + "\"," +
"\"cityName\":\"" + res.cityName + "\"," +
"\"countyName\":\"" + res.countyName + "\"," +
"\"detailInfo\":\"" + res.detailInfo + "\"," +
"\"nationalCode\":\"" + res.nationalCode + "\"," +
"\"telNumber\":\"" + res.telNumber + "\"" +
"}"
that.setData({
trade_addr: trade_addr,
buyerInfo: JSON.parse(buyerInfoStr)
})
console.log(that.data.buyerInfo)
}
})
}
微信小程序开发问题解答
微信小程序开发者回答:
希望尽快吧,强迫症看到bug咬牙启齿
微信小程序开发者回答: 嗯,开发者工具在 v2.4.4 和 v2.5.0 的基础库中只要发生切后台的行为,都会产生这个错误。真机上不会产生这个错误。我们会在下个基础库版本中进行修复。
本文网址:http://www.91bianli.com/weixinxiaochengxu/494.html