从H5跳转到原生页面,安卓机渲染页面不成功?
最近遇见一个奇怪问题,小程序里嵌套了一个webview,H5中存在一个跳转至小程序的按钮,iPhone手机可以正常渲染,而安卓手机(不管型号)不能正常渲染,在页面的onLoad和onShow里都加上了弹出内容来确认页面是否执行,结果显示,在安卓机上,第一次onShow和onLoad都不执行,第二次才执行
H5跳转的代码
created(){ let servicebranch = sessionStorage.getItem("servicebranch"); window.wx.miniProgram.navigateTo({ url: "/pages/scan/scan?scan_scene=goods_barcode&branch="+servicebranch }); } |
微信原生页面
/** * 生命周期函数--监听页面显示 */ onShow: function(options) { wx.showModal({ title: 'onshow', content: 'onshow', }) let phoneSystem = this.data.phoneSystem + ''; if (phoneSystem.indexOf('Android') > -1) { this.onLoad(); } }, |
/** * 生命周期函数--监听页面加载 */ onLoad: function(options) { wx.showModal({ title: 'onload', content: 'onload', }) console.log(options); this.setData({ phoneSystem: app.globalData.phoneSystem }) if (app.globalData.shopname) { wx.setNavigationBarTitle({ title: app.globalData.shopname, }) } if (app.globalData.theme_color_1) { this.setData({ themeColor: app.globalData.theme_color_1 }); } if(options){ this.setData({ scan_scene: options.scan_scene, branch: options.branch, logo: app.globalData.logo }); } if (!app.globalData.openid) { app.toLogin().then(function(res) { app.globalData.openid = res; }).catch(function(res) { wx.showToast({ title: '授权失败', icon: 'fail', duration: 2000 }) }) } // this.toScan(); }, |
