小程序版本更新(uni-app)

2021/6/25 11:27:17

本文主要是介绍小程序版本更新(uni-app),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

App.vue文件   onLaunch: function() {     console.log("App Launch");     const updateManager = uni.getUpdateManager();     updateManager.onCheckForUpdate(function(res) {       // 请求完新版本信息的回调       if (res.hasUpdate) {         updateManager.onUpdateReady(function(res2) {           uni.showModal({             title: "更新提示",             content: "发现新版本,请更新...",             confirmColor: "#E30012",             showCancel: false,             success(res2) {               if (res2.confirm) {                 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启                 updateManager.applyUpdate();               }             },           });         });       }     });     updateManager.onUpdateFailed(function(res) {       // 新的版本下载失败       uni.showModal({         title: "提示",         content: "新版本下载失败,请检查网络!",       });     });   },

这篇关于小程序版本更新(uni-app)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程