if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) {
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,重启应用使用新版本',
showCancel: false,
confirmColor: "#04303d",
success: function (res) {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
}
})
updateManager.onUpdateFailed(function () {
console.log("onUpdateFailed 新版本下载失败");
wx.showModal({
title: '更新提示',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
confirmColor: "#04303d",
})
})
}