收藏
回答

为什么?为什么呢?按照官方示例调用更新提示接口,小程序版本更新提示本地测试能提示,但是上线始终就不行

问题点:

为什么?为什么呢?按照官方示例调用wx.getUpdateManager() 更新提示接口,小程序版本更新提示本地测试能提示,但是上线始终就不行

appid: wx48b2ead80e63d9f1

官方API:小程序更新机制

https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/update-mechanism.html

参考社区方案没用:wx.getUpdateManager() 为什么检测不到小程序版本更新?

https://developers.weixin.qq.com/community/develop/doc/00064a5282c79081e963deae069c00?highLine=wx.getUpdateManager%28%29%2520%25E4%25B8%25BA%25E4%25BB%2580%25E4%25B9%2588%25E6%25A3%2580%25E6%25B5%258B%25E4%25B8%258D%25E5%2588%25B0%25E5%25B0%258F%25E7%25A8%258B%25E5%25BA%258F%25E7%2589%2588%25E6%259C%25AC%25E6%259B%25B4%25E6%2596%25B0%25EF%25BC%259F

代码片段:

onShow: function() {
        console.log("App Show");
        // 获取小程序配置
        this.$store.dispatch('fetchMiniAppConfig')
        // 检查小程序版本更新
        const updateManager = uni.getUpdateManager();
        updateManager.onCheckForUpdate(function(res) {
            console.log(res.hasUpdate);
    });
            updateManager.onUpdateReady(function(res) {
                uni.showModal({
                    title: '更新提示',
                    content: '新版本已经准备好,是否重启应用?',
                    success(res) {
                        if (res.confirm) {
                            updateManager.applyUpdate();
                }
            }
        });
    });
            updateManager.onUpdateFailed(function(res) {
                uni.showModal({
                    title: '更新提示',
                    content: '新版本下载失败,请检查网络后重试。',
                    showCancel: false
        });
    });
}

@腾讯官方

最后一次编辑于  11-11
回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    11-11
    有用
登录 后发表内容