TakeOutShop/App.vue
2025-03-04 23:07:40 +08:00

37 lines
887 B
Vue

<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
// 获得小程序最新版本
let updateManager = wx.getUpdateManager();
if (updateManager) {
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function() {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
}
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
/*每个页面公共css */
</style>