const VersionCheck = () => { if (!wx.canIUse('getUpdateManager')) { return } const updateManger = wx.getUpdateManager() updateManger.onCheckForUpdate(function (res) { console.log('版本信息', res) }) updateManger.onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已准备好,是否重启用用?', success(res) { if (res.confirm) { updateManger.applyUpdate() } }, }) }) updateManger.onUpdateFailed(function () { console.log('新版本下载失败') }) } export default VersionCheck