// 不兼容 api 场景1154: 朋友圈内打开“单页模式” if(e.scene!=1154){ //版本更新 const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate(function(res) { // 请求完新版本信息的回调 console.log(res.hasUpdate) }) updateManager.onUpdateReady(function() { wx.showModal({ title: '更新提示', content: '检测到新版本更新,需要重新启动!', // showCancel:false, success(res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) updateManager.onUpdateFailed(function() { // 新版本下载失败 }) }
对于小程序,可以在 App 的 onLaunch 和 onShow,或wx.getLaunchOptionsSync 中获取上述场景值。
对于小游戏,可以在 wx.getLaunchOptionsSync 和 wx.onShow 中获取上述场景值
基于场景下判断 新版本是否更新
从朋友圈进入小程序 无法获取本地存储的登录信息