美文网首页
//检查微信小程序是否最新版本重启应用-解决页面缓存问题

//检查微信小程序是否最新版本重启应用-解决页面缓存问题

作者: YoungHer | 来源:发表于2021-08-05 10:41 被阅读0次

//检查微信小程序是否最新版本

        checkForUpdate: function() {

                    const updateManager = wx.getUpdateManager()

                    updateManager.onUpdateReady(function() {

                                wx.showModal({

                                            title: '更新提示',

                                            content: '新版本已经准备好,是否重启应用?',

                                            success: function(res) {

                                                        if (res.confirm) {

                                                                    updateManager.applyUpdate()

                                                            }

                                            }

                                })

                    })

        };

将此函数放到app.js中,在

onLaunch

this.checkForUpdate()

中调用即可

相关文章

网友评论

      本文标题://检查微信小程序是否最新版本重启应用-解决页面缓存问题

      本文链接:https://www.haomeiwen.com/subject/etlmvltx.html