当前位置:网站首页>Applet version update

Applet version update

2022-06-13 04:23:00 Twinkle, twinkle, twinkle, twinkle, twinkle, twinkle, twinkle,

 //  Check for new versions 
    if (wx.canIUse('getUpdateManager')) {
      const updateManager = wx.getUpdateManager()
      updateManager.onCheckForUpdate(function (res) {
        if (res.hasUpdate) {
          updateManager.onUpdateReady(function () {
            wx.showModal({
              title: ' Update hints ',
              content: ' The new version is ready , Restart application or not ?',
              success: function (res) {
                if (res.confirm) {
                  updateManager.applyUpdate()
                }
              }
            })
          })
          updateManager.onUpdateFailed(function () {
            wx.showModal({
              title: ' There is a new version ~',
              content: ' The new version is online ~, Please delete the current applet , Search again open ~'
            })
          })
        }
      })
    } else {
      wx.showModal({
        title: ' Tips ',
        content: ' Current wechat version is too low , This feature is not available , Please upgrade to the latest wechat version and try again .'
      })
    }

原网站

版权声明
本文为[Twinkle, twinkle, twinkle, twinkle, twinkle, twinkle, twinkle, ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280523392278.html