合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
933 B

3 months ago
  1. <script lang="uts">
  2. let firstBackTime = 0
  3. export default {
  4. onLaunch: function () {
  5. console.log('App Launch')
  6. },
  7. onShow: function () {
  8. console.log('App Show')
  9. },
  10. onHide: function () {
  11. console.log('App Hide')
  12. },
  13. // #ifdef APP-ANDROID
  14. onLastPageBackPress: function () {
  15. console.log('App LastPageBackPress')
  16. if (firstBackTime == 0) {
  17. uni.showToast({
  18. title: '再按一次退出应用',
  19. position: 'bottom',
  20. })
  21. firstBackTime = Date.now()
  22. setTimeout(() => {
  23. firstBackTime = 0
  24. }, 2000)
  25. } else if (Date.now() - firstBackTime < 2000) {
  26. firstBackTime = Date.now()
  27. uni.exit()
  28. }
  29. },
  30. // #endif
  31. onExit: function () {
  32. console.log('App Exit')
  33. },
  34. }
  35. </script>
  36. <style>
  37. @import "@/static/iconfont.css";
  38. /*每个页面公共css */
  39. .uni-row {
  40. flex-direction: row;
  41. }
  42. body{
  43. background-color: #ffffff;
  44. }
  45. .uni-column {
  46. flex-direction: column;
  47. }
  48. </style>