123456789101112131415161718192021222324252627282930 |
- module.exports = {
- update: update
- }
- var isShowed = false;
- //检测版本是否更新
- function update() {
- if (isShowed) {
- return;
- }
- //检测版本更新
- const manager = wx.getUpdateManager();
- //检测版本是否更新
- manager.onCheckForUpdate(function (e) {});
- //版本更新
- manager.onUpdateReady(function (e) {
- isShowed = true;
- wx.showModal({
- title: '更新提示',
- content: '新版本已准备好,是否重启应用?',
- success: function (res) {
- if (res.confirm) {
- manager.applyUpdate();
- }
- }
- });
- });
- //版本更新失败
- manager.onUpdateFailed(function (e) {});
- };
|