微信小程序代码提交发布之后,必须删除原来的小程序才会更新到最新的代码

//检查微信小程序是否最新版本

checkForUpdate: function () {

const updateManager = wx.getUpdateManager()

updateManager.onUpdateReady(function () {

wx.showModal({

title: '更新提示',

content: '新版本已经准备好,是否重启应用?',

success: function (res) {

if (res.confirm) {

updateManager.applyUpdate()

}

}

})

})

updateManager.onUpdateFailed(function () { })

},

将此函数放到app.js中,在

onLaunch

this.checkForUpdate()

中调用即可

 

posted @ 2022-06-23 14:02  luckylou  阅读(322)  评论(0编辑  收藏  举报