1、app.js onShow调用即可
checkUpdate(){
if(wx.canIUse('getUpdateManager')){
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) {
updateManager.onUpdateReady(function () {
updateManager.applyUpdate();
})
updateManager.onUpdateFailed(function () {
wx.showModal({
title: '更新提示',
content: '新版本已上线,请删除当前小程序,重新搜索打开~'
})
})
}
})
}
},