添加版本更新提示
This commit is contained in:
39
App.vue
39
App.vue
@ -1,8 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function() {
|
||||||
console.log("App Launch");
|
// debugger
|
||||||
|
const updateManager = uni.getUpdateManager()
|
||||||
|
updateManager.onCheckForUpdate(function (res) {
|
||||||
|
// 请求完新版本信息的回调
|
||||||
|
console.log(res.hasUpdate)
|
||||||
|
})
|
||||||
|
// 下载新版本
|
||||||
|
updateManager.onUpdateReady(function () {
|
||||||
|
uni.showModal({
|
||||||
|
title: '更新提示',
|
||||||
|
content: '新版本已经准备好,是否重启应用?',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 重启应用
|
||||||
|
updateManager.applyUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// 新版本下载失败
|
||||||
|
updateManager.onUpdateFailed(function (res) {
|
||||||
|
// 新的版本下载失败
|
||||||
|
uni.showModal({
|
||||||
|
title: '已经有新版本了哟~',
|
||||||
|
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
console.log("App Show");
|
console.log("App Show");
|
||||||
@ -43,17 +70,17 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 自动登录
|
// 自动登录
|
||||||
async autoLogin(data) {
|
async autoLogin(data) {
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "animate.css";
|
@import "animate.css";
|
||||||
|
Reference in New Issue
Block a user