App.vue 1.6 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
<script lang="ts">
DCloud-WZF's avatar
DCloud-WZF 已提交
2
import { state, setLifeCycleNum } from './store/index.uts'
3 4
export default {
  onLaunch: function () {
DCloud-WZF's avatar
DCloud-WZF 已提交
5
    setLifeCycleNum(state.lifeCycleNum + 1000)
6 7 8 9 10 11 12 13 14
    console.log("App Launch");

    // const performance: Performance = uni.getPerformance()
    // const observer1: PerformanceObserver = performance.createObserver((entryList: PerformanceObserverEntryList) => {
    //   console.log("observer1:entryList.getEntries()" + JSON.stringify(entryList.getEntries()))
    // })
    // observer1.observe({ entryTypes: ['render', 'navigation'] } as PerformanceObserverOptions)
  },
  onShow: function () {
DCloud-WZF's avatar
DCloud-WZF 已提交
15
    setLifeCycleNum(state.lifeCycleNum + 100)
16 17 18
    console.log("App Show");
  },
  onHide: function () {
DCloud-WZF's avatar
DCloud-WZF 已提交
19
    setLifeCycleNum(state.lifeCycleNum - 100)
20 21 22
    console.log("App Hide");
  },
  onLastPageBackPress: function (): boolean | null {
DCloud-WZF's avatar
DCloud-WZF 已提交
23
    setLifeCycleNum(state.lifeCycleNum - 1000)
24 25 26 27
    uni.showToast({
      title: "再按一次退出应用",
      position: "bottom",
    });
28 29 30
    return null;
  },
};
Y
init  
yurj26 已提交
31 32 33
</script>

<style>
34 35 36 37 38 39 40 41 42 43 44 45
/*每个页面公共css */
@import "./common/uni.css";

/* #ifdef H5 */
@media screen and (min-width: 768px) {
  body {
    overflow-y: scroll;
  }
}

/* 顶栏通栏样式 */
/* .uni-top-window {
Y
yurj26 已提交
46 47 48 49
  	    left: 0;
  	    right: 0;
  	} */

50 51 52 53 54
uni-page-body {
  background-color: #f5f5f5 !important;
  min-height: 100% !important;
  height: auto !important;
}
Y
yurj26 已提交
55

56 57 58
.uni-top-window uni-tabbar .uni-tabbar {
  background-color: #fff !important;
}
Y
yurj26 已提交
59

60 61 62
.uni-app--showleftwindow .hideOnPc {
  display: none !important;
}
Y
yurj26 已提交
63

64 65
/* #endif */
</style>