export default function checkVersion () { return new Promise((resolve, reject) => { if (wx.canIUse("getUpdateManager")) { const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate(res => { if (res.hasUpdate) { updateManager.onUpdateReady(() => { wx.showModal({ title: "更新提示", content: "新版本已经准备好, 是否重启应用", success (successRes) { if (successRes.confirm) { updateManager.applyUpdate() } } }) resolve(true) }) updateManager.onUpdateFailed(() => { wx.showModal({ title: "更新提示", content: "新版本已经上线了,请您删除当前小程序,重新搜索打开~" }) reject(false) }) } else { resolve(true) } }) } else { reject(false) } }) }