You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
984 B
37 lines
984 B
12 months ago
|
<script>
|
||
|
export default {
|
||
|
onLaunch: function() {
|
||
|
// uni.setEnableDebug({
|
||
|
// enableDebug: true
|
||
|
// })
|
||
|
},
|
||
|
onShow: function() {
|
||
|
console.log('App Launch');
|
||
|
const updateManager = uni.getUpdateManager();
|
||
|
// 检查小程序是否有新版本发布
|
||
|
updateManager.onCheckForUpdate(function (res) {
|
||
|
// 请求完新版本信息的回调
|
||
|
console.log('onCheckForUpdate', res.hasUpdate);
|
||
|
});
|
||
|
|
||
|
// 小程序有新版本,则静默下载新版本,做好更新准备
|
||
|
updateManager.onUpdateReady(function (res) {
|
||
|
updateManager.applyUpdate()
|
||
|
});
|
||
|
|
||
|
updateManager.onUpdateFailed(function (res) {
|
||
|
console.log('onUpdateFailed', res);
|
||
|
// 新的版本下载失败
|
||
|
uni.showModal({
|
||
|
title: '已经有新版本了哟~',
|
||
|
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
|
||
|
});
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
@import '@/uni_modules/uni-scss/index.scss';
|
||
|
</style>
|