4 Star 7 Fork 2

刘明 / easyx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
App.uvue 960 Bytes
一键复制 编辑 原始数据 按行查看 历史
刘明 提交于 2023-12-21 15:10 . 1.0.0
<script lang="uts">
let firstBackTime = 0
export default {
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
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()
}
},
onExit: function () {
console.log('App Exit')
},
}
</script>
<style>
/*每个页面公共css */
.uni-row {
flex-direction: row;
}
.uni-column {
flex-direction: column;
}
.container {
padding: 15px;
}
.title {
margin: 15px 0;
}
.mt-15 {
margin-top: 15px;
}
.m-15 {
margin: 15px;
}
</style>
1
https://gitee.com/liuming9157/easyx.git
git@gitee.com:liuming9157/easyx.git
liuming9157
easyx
easyx
master

搜索帮助