From b4c0fe11301caab19fffabab4a4a4902e7cfd316 Mon Sep 17 00:00:00 2001 From: kuaileWu <1432334894@qq.com> Date: Tue, 1 Jul 2025 17:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/App.vue b/App.vue index d4f6022..36ba049 100644 --- a/App.vue +++ b/App.vue @@ -4,6 +4,42 @@ doctorId:'', doctoridStorageKey:'doctor_id' }, + + onShow: function() { + var updateManager = uni.getUpdateManager(); + updateManager.onCheckForUpdate(function(res) { + console.log("是否有最近版本", res.hasUpdate) + }); + + updateManager.onUpdateReady(function(res) { + uni.showModal({ + title: '更新提示', + content: '新版本已经准备好,是否重启应用?', + showCancel: false, + success(res) { + if (res.confirm) { + updateManager.applyUpdate(); + } + } + }); + }); + + updateManager.onUpdateFailed(function(res) { + uni.showModal({ + title: '提示', + content: '新版小程序下载失败\n请自行退出程序,手动卸载本程序,再运行', + confirmText: "知道了", + showCancel: false, + success(res) { + wx.exitMiniProgram({ + success: () => { + console.log('退出小程序成功'); + } + }); + } + }); + }); + }, onLaunch: function(option) { console.log(option, 'option===='); var did = false @@ -82,7 +118,6 @@ } }, - onShow: function() {}, onHide: function() {} }