收藏
回答

版本更新提示点击更新后没有重载小程序偶现?

  onLaunch: function (options) {
        this.checkUpdate();
}
checkUpdate() {
            if (!wx.canIUse('getUpdateManager')) {
                wx.showModal({
                    title: '提示',
                    content: '当前版本过低,无法检测更新,请升级客户端',
                    showCancel: false
                });
                return;
            }


            const updateManager = wx.getUpdateManager();
            updateManager.onCheckForUpdate((res) => {
                console.log(res, 'updateManager');
                if (res.hasUpdate) {
                    console.log('有新版本可用');
                }
            });


            updateManager.onUpdateReady(() => {
                wx.showModal({
                    title: '发现新版本',
                    content: '我们为您准备了更好的使用体验\n请尽快更新到最新版本。',
                    confirmText: '立即更新',
                    showCancel: false,
                    success: (res) => {
                        if (res.confirm) {
                            updateManager.applyUpdate();
                        }
                    }
                });
            });


            updateManager.onUpdateFailed(() => {
                wx.showModal({
                    title: '更新失败',
                    content: '新版本下载失败,请稍后再试或手动重启',
                    showCancel: false
                });
            });
        },
回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    2025-10-24

    具体表现是什么 点击没有反应吗

    2025-10-24
    有用
    回复 2
    • 某时某刻
      某时某刻
      2025-11-20
      是的  用户点击立即更新 然后没有任何变化 还是旧版本
      2025-11-20
      回复
    • Hxeer
      Hxeer
      01-09回复某时某刻
      点击立即更新后会重新弹立即更新提示吗?
      01-09
      回复
  • 智能回答 智能回答 本次回答由AI生成
    2025-10-20
    有用
登录 后发表内容