Browse Source

版本更新

master
kuaileWu 2 months ago
parent
commit
b4c0fe1130
  1. 37
      App.vue

37
App.vue

@ -4,6 +4,42 @@
doctorId:'', doctorId:'',
doctoridStorageKey:'doctor_id' 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) { onLaunch: function(option) {
console.log(option, 'option===='); console.log(option, 'option====');
var did = false var did = false
@ -82,7 +118,6 @@
} }
}, },
onShow: function() {},
onHide: function() {} onHide: function() {}
} }
</script> </script>

Loading…
Cancel
Save