57 lines
1.9 KiB
Vue
57 lines
1.9 KiB
Vue
|
|
<script>
|
||
|
|
export default {
|
||
|
|
methods: {},
|
||
|
|
onLaunch() {
|
||
|
|
// 版本更新
|
||
|
|
const updateManager = wx.getUpdateManager()
|
||
|
|
// 请求完新版本信息的回调
|
||
|
|
updateManager.onCheckForUpdate(function(res) {
|
||
|
|
console.log("是否有新版本", res.hasUpdate)
|
||
|
|
})
|
||
|
|
// 新版本下载成功
|
||
|
|
updateManager.onUpdateReady(function() {
|
||
|
|
wx.showModal({
|
||
|
|
title: '更新提示',
|
||
|
|
content: '新版本已经准备好,是否重启应用?',
|
||
|
|
success: function(res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||
|
|
updateManager.applyUpdate()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
})
|
||
|
|
// 新版本下载失败
|
||
|
|
updateManager.onUpdateFailed(function() {
|
||
|
|
wx.showModal({
|
||
|
|
title: '新版本更新失败',
|
||
|
|
content: '请退出并移除小程序,重新打开...',
|
||
|
|
})
|
||
|
|
})
|
||
|
|
// 系统信息
|
||
|
|
// uni.getSystemInfo({
|
||
|
|
// success: e => {
|
||
|
|
// let res = uni.getMenuButtonBoundingClientRect()
|
||
|
|
// let statusBarHeight = {
|
||
|
|
// BarTopHeight: res.top,
|
||
|
|
// BarTopLineHeight: res.height + 10,
|
||
|
|
// BarMarginTop: Number(res.top + res.height + 10)
|
||
|
|
// }
|
||
|
|
// this.$store.commit("handleBarHeight", statusBarHeight);
|
||
|
|
// console.log("系统信息", e, res)
|
||
|
|
// }
|
||
|
|
// })
|
||
|
|
},
|
||
|
|
mounted() {},
|
||
|
|
onShow: function() {
|
||
|
|
console.log('App Show')
|
||
|
|
},
|
||
|
|
onHide: function() {
|
||
|
|
console.log('App Hide')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss">
|
||
|
|
</style>
|