Files

62 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2025-12-08 19:01:09 +08:00
<script lang="uts">
// #ifdef APP-ANDROID || APP-HARMONY
let firstBackTime = 0
// #endif
export default {
onLaunch: function () {
console.log('App Launch')
2025-12-22 19:16:53 +08:00
// 检查是否已选择模式
this.checkModeSelection()
2025-12-08 19:01:09 +08:00
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
// #ifdef APP-ANDROID || APP-HARMONY
onLastPageBackPress: function () {
console.log('App LastPageBackPress')
if (firstBackTime == 0) {
uni.showToast({
title: '再按一次退出应用',
position: 'bottom',
})
firstBackTime = Date.now()
setTimeout(() => {
firstBackTime = 0
}, 2000)
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now()
uni.exit()
}
},
// #endif
onExit: function () {
console.log('App Exit')
},
2025-12-22 19:16:53 +08:00
methods: {
// 检查并选择模式
checkModeSelection() {
const mode = uni.getStorageSync('userMode')
}
}
2025-12-08 19:01:09 +08:00
}
</script>
<style>
/*每个页面公共css */
2025-12-23 13:27:36 +08:00
view {
border: none;
background-color: transparent;
box-sizing: border-box;
}
2025-12-08 19:01:09 +08:00
.uni-row {
flex-direction: row;
}
.uni-column {
flex-direction: column;
}
</style>