小程序app.onLaunch里获取用户信息,失败则跳转到err页面,代码如下
wx.getUserInfo({
success: res => {
that.globalData.userInfo = res.userInfo
logger.info(‘app getUserInfo suss:’,res.userInfo)
},
fail: res => {
logger.info(‘app getUserInfo fail’)
that.globalData.errObj = that.getErrObj(‘获取用户标识失败’, res,101)
wx.navigateTo({
url: ‘/pages/index/err’,
suss:res=>{
logger.info(‘app navigateTo err suss’,res)
},
fail: res => {
logger.info(‘app navigateTo err fail’, res)
}
})
}
})
运行后能正确跳转到/pages/index/err页面,但是并没有打印出app navigateTo err suss或app navigateTo err fail,控制台报错
navigateTo with an already exist webviewId 197,位置介于err页面的onready和onshow之间。
2017/10/24 10:52:31 INFO app getUserInfo fail
logger.js? [sm]:19 2017/10/24 10:52:32 INFO aaa
logger.js? [sm]:19 2017/10/24 10:52:32 INFO ccc
WAService.js:9 Tue Oct 24 2017 10:52:32 GMT+0800 (中国标准时间) Page route 错误(system error)
WAService.js:9 navigateTo with an already exist webviewId 197
t.error @ WAService.js:9
B @ WAService.js:8
F @ WAService.js:8
(anonymous) @ WAService.js:8
(anonymous) @ WAService.js:9
(anonymous) @ WAService.js:4
(anonymous) @ WAService.js:4
(anonymous) @ WAService.js:4
d @ appservice:16
f.registerCallback @ appservice:16
k.forEach @ appservice:16
d @ appservice:16
h.onmessage @ appservice:16
logger.js? [sm]:19 2017/10/24 10:52:32 INFO bbb
err页面代码
onLoad: function (options) {
app.getlogger().info(‘aaa’)
},
onReady: function () {
app.getlogger().info(‘bbb’)
},
onShow: function () {
app.getlogger().info(‘ccc’)
},