发现版本更新提示会被其他东西干扰导致消失,请问是否有解决方法?
发布于 7 年前 作者 xuegang 4580 次浏览 来自 官方Issues
  1. 更新提示出来后,在首页突然消失了
  2. 从其他应用切回微信小程序页面,提示再次出现

更新提示的代码是从开发文档的示例中直接复制的(https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html),如下:

const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
  wx.showModal({
    title: '更新提示',
    content: '新版本已经准备好,是否重启应用?',
    success: function (res) {
      if (res.confirm) {
        // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
        updateManager.applyUpdate()
      }
    }
  })
})
回到顶部