App.uvue 1.8 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3
<script lang="uts">
import { state, setLifeCycleNum } from '@/store/index.uts'

4 5
export default {
  onLaunch: function () {
6
    // 自动化测试
DCloud-WZF's avatar
DCloud-WZF 已提交
7
    setLifeCycleNum(state.lifeCycleNum + 1000)
8
    console.log('App Launch')
9

H
hdx 已提交
10
    const performance = uni.getPerformance()
11 12 13 14 15 16 17 18 19 20 21
    const observer1: PerformanceObserver = performance.createObserver(
      (entryList: PerformanceObserverEntryList) => {
        console.log(
          'observer1:entryList.getEntries()' +
            JSON.stringify(entryList.getEntries())
        )
      }
    )
    observer1.observe({
      entryTypes: ['render', 'navigation'],
    } as PerformanceObserverOptions)
22 23
  },
  onShow: function () {
24
    // 自动化测试
DCloud-WZF's avatar
DCloud-WZF 已提交
25
    setLifeCycleNum(state.lifeCycleNum + 100)
26
    console.log('App Show')
27 28
  },
  onHide: function () {
29
    // 自动化测试
DCloud-WZF's avatar
DCloud-WZF 已提交
30
    setLifeCycleNum(state.lifeCycleNum - 100)
31
    console.log('App Hide')
32 33
  },
  onLastPageBackPress: function (): boolean | null {
34
    // 自动化测试
DCloud-WZF's avatar
DCloud-WZF 已提交
35
    setLifeCycleNum(state.lifeCycleNum - 1000)
DCloud-WZF's avatar
DCloud-WZF 已提交
36
    console.log('App LastPageBackPress')
37
    return null
38
  },
DCloud-WZF's avatar
DCloud-WZF 已提交
39 40 41 42 43 44
  methods: {
    increasetLifeCycleNum() {
      setLifeCycleNum(state.lifeCycleNum + 100)
      console.log('App increasetLifeCycleNum')
    }
  }
45
}
Y
init  
yurj26 已提交
46 47 48
</script>

<style>
49
/*每个页面公共css */
50
@import './common/uni.css';
51 52 53 54 55 56 57 58 59 60

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

/* 顶栏通栏样式 */
/* .uni-top-window {
Y
yurj26 已提交
61 62 63 64
  	    left: 0;
  	    right: 0;
  	} */

65 66 67 68 69
uni-page-body {
  background-color: #f5f5f5 !important;
  min-height: 100% !important;
  height: auto !important;
}
Y
yurj26 已提交
70

71 72 73
.uni-top-window uni-tabbar .uni-tabbar {
  background-color: #fff !important;
}
Y
yurj26 已提交
74

75 76 77
.uni-app--showleftwindow .hideOnPc {
  display: none !important;
}
Y
yurj26 已提交
78

79 80
/* #endif */
</style>