非tab页面的wx.redirectTo和wx.navigateTo跳转后白屏
你想反馈一个 Bug 还是 提一个需求?
反馈一个bug
如果是 Bug:
* Bug 表现是什么?预期表现是什么?
在IDE上的时候,页面跳转正常。
使用真机远程调试的时候,ios和安卓都有白屏的情况,
具体来说,从非tab页面A进入到非tab页面B的时候,无论选择wx.redirectTo跳转还是用wx.navigateTo跳转,都是白屏。B页面的onload()和onready()都没有加载。此时A和B应该都没有超过10层。tab页面—>非tab页面O—>非tab页面A—>非tab页面B
其实从非tab页面O—>非tab页面A之前也会
出现白屏的情况,在跳转函数上加了个setTimeout函数以后,目前可以正常跳转了。但是这应该不是个根本的办法吧。
另外,跳转的时候,debugger发现,会返回wx.redirectTo的回调函数success:
success:res=>{ console.log('成功跳转',res) },问题图片:
* 如何复现?
* 提供一个最简复现 Demo
js代码:
nextpage:function(){ debugger var _this = this; var ApiHost = app.globalData.ApiHost var token = 'token '+ wx.getStorageSync('token') var order_id = _this.order_id var id = _this.id var customer = _this.customer // ???此处之前的method为PATCH ,但是因为wx.request并不支持这种方法, // 会导致nextpage函数报invoke错误,所以改为PUT setTimeout(function(){ wx.request({ url: ApiHost + "/api/v1/orders_v4/" + order_id + "/", method: 'PUT', header:{ 'AUTHORIZATION': token // 默认值 }, data: { goods: id, }, success: res => { debugger utils.logWrite('用户进入info页面', res) setTimeout(function(){ wx.redirectTo({ url:'../skeletonTest/skeletonTest', // url:'../info/info?order_id=' // +_this.order_id +'&customer=' // +_this.customer, success:res=>{ console.log('成功跳转',res) }, fail:err=>{ debugger console.log('跳转失败',err) } }) },200) }, fail: err => { debugger console.log(_this) utils.logWrite('进入手机套餐页失败',err) } }) },200) } |
<view class="weui-btn-area"> <button class="weui-btn" bindtap="nextpage">下一步</button></view> |
