提交 10ac639b 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(onLastPageBackPress): 条件编译指定平台

上级 7e4a6207
<!-- HBuilder X 版本要求: 3.6.11+ --> <!-- HBuilder X 版本要求: 3.6.11+ -->
<script lang="ts"> <script lang="ts">
let firstBackTime = 0 let firstBackTime = 0
export default { export default {
onLaunch: function () { onLaunch: function () {
console.log('App Launch') console.log('App Launch')
}, },
...@@ -11,8 +11,8 @@ export default { ...@@ -11,8 +11,8 @@ export default {
onHide: function () { onHide: function () {
console.log('App Hide') console.log('App Hide')
}, },
onLastPageBackPress: function () {
// #ifdef UNI-APP-X && APP-ANDROID // #ifdef UNI-APP-X && APP-ANDROID
onLastPageBackPress: function () {
console.log('App LastPageBackPress') console.log('App LastPageBackPress')
if (firstBackTime == 0) { if (firstBackTime == 0) {
uni.showToast({ uni.showToast({
...@@ -27,18 +27,18 @@ export default { ...@@ -27,18 +27,18 @@ export default {
firstBackTime = Date.now() firstBackTime = Date.now()
uni.exit() uni.exit()
} }
// #endif
}, },
// #endif
onExit() { onExit() {
console.log('App Exit') console.log('App Exit')
}, },
} }
</script> </script>
<style> <style>
/*每个页面公共css */ /*每个页面公共css */
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */ /* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
/* #ifdef APP-VUE */ /* #ifdef APP-VUE */
@import './common/uni.css'; @import './common/uni.css';
/* #endif */ /* #endif */
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册