Commit b664afdf authored by Facius's avatar Facius

版本更新

......@@ -56,6 +56,9 @@ export default {
AnalysysAgent.registerSuperProperty("platform", "self-support");
// 应用启动,或从后台进入前台显示
that.autoLogin();
// 版本更新
this.updateApp()
},
onShow: function () {
// 应用启动,或从后台进入前台显示
......@@ -138,6 +141,35 @@ export default {
this.$u.vuex("vuex_token", "");
}
},
/* 版本更新 */
updateApp() {
// 版本更新
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) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function (res) {
// 新的版本下载失败
});
},
/* ------------------------- 数据埋点begin ------------------------------ */
track(event, properties) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment