checkUpdate(){
    console.log('----->>checkVersionUpadte')
    const updateManager = wx.getUpdateManager()
    updateManager.onCheckForUpdate(function (res) {
      // 请求完新版本信息的回调
      console.log('versionBack==>', res.hasUpdate)
    })

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

    })

    updateManager.onUpdateFailed(function () {
      // 新的版本下载失败
    })
  },
onShow: function () {
    console.log('------>>onShow')
    this.checkUpdate()
    this.refreshInfo()
  },

 

相关文章:

  • 2021-12-07
  • 2021-12-06
  • 2021-10-18
  • 2022-01-15
  • 2021-04-13
  • 2021-11-07
  • 2021-05-23
猜你喜欢
  • 2022-01-07
  • 2021-11-27
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
相关资源
相似解决方案