| @@ -43,6 +43,24 @@ onLaunch(() => { | |||||
| }); | }); | ||||
| uni.setStorageSync("userId", "114514"); | uni.setStorageSync("userId", "114514"); | ||||
| const updateManager = uni.getUpdateManager(); | |||||
| updateManager.onUpdateReady(function (res) { | |||||
| uni.showModal({ | |||||
| title: "更新提示", | |||||
| content: "有新的版本哦,请重启小程序应用更新", | |||||
| showCancel: false, | |||||
| confirmText: "立刻重启", | |||||
| confirmColor: "#ff4f00", | |||||
| success(res) { | |||||
| if (res.confirm) { | |||||
| // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | |||||
| updateManager.applyUpdate(); | |||||
| } | |||||
| }, | |||||
| }); | |||||
| }); | |||||
| }); | }); | ||||
| onShow(() => { | onShow(() => { | ||||
| console.log("App Show!"); | console.log("App Show!"); | ||||