锦水居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

34 lines
1021 B

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)
}
})
}