new-page.uvue 1.2 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<template>
  <view class="uni-padding-wrap">
    <text>onLoad 接收到参数</text>
    <text>data: {{ data }}</text>
  </view>
</template>
<script lang="ts">
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
  data() {
    return {
      data: '',
    }
  },
  onLoad(options: OnLoadOptions) {
    console.log('new-page onLoad', options)
    if(options.has('data')) {
      this.data = options.get('data')!
    }
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 100)
  },
  onShow() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onReady() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onHide() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
  },
  onBackPress(_: OnBackPressOptions): boolean | null {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
    return null
  },
  onUnload() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 100)
  },
  methods: {
    // 自动化测试
    getLifeCycleNum(): number {
      return state.lifeCycleNum
    },
    // 自动化测试
    setLifeCycleNum(num: number) {
      setLifeCycleNum(num)
    },
  },
}
</script>