new-page-2.uvue 2.0 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
<template>
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3 4 5
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
    <!-- #endif -->
    <view class="uni-padding-wrap container">
DCloud-WZF's avatar
DCloud-WZF 已提交
6 7 8
      <page-head title="new-page-2" />
      <button @click="scrollToBottom">scrollToBottom</button>
    </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
9
    <!-- #ifdef APP -->
DCloud-WZF's avatar
DCloud-WZF 已提交
10
  </scroll-view>
DCloud-WZF's avatar
DCloud-WZF 已提交
11
  <!-- #endif -->
DCloud-WZF's avatar
DCloud-WZF 已提交
12
</template>
DCloud-WZF's avatar
DCloud-WZF 已提交
13

DCloud-WZF's avatar
DCloud-WZF 已提交
14 15 16
<script lang="uts">
import { State, state, setLifeCycleNum } from '@/store/index.uts'

DCloud-WZF's avatar
DCloud-WZF 已提交
17
export default {
DCloud-WZF's avatar
DCloud-WZF 已提交
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
  data() {
    return {
      _state: state as State,
      isScrolled: false,
    }
  },
  onLoad(_ : OnLoadOptions) {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 100)
  },
  onShow() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onReady() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onPullDownRefresh() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onPageScroll(_) {
    // 自动化测试
    this.isScrolled = true
  },
  onReachBottom() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onBackPress(_ : OnBackPressOptions) : boolean | null {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
    return null
  },
  onHide() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
  },
  onUnload() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 100)
  },
  methods: {
    // 自动化测试
    getLifeCycleNum() : number {
      return state.lifeCycleNum
    },
    // 自动化测试
    setLifeCycleNum(num : number) {
      setLifeCycleNum(num)
    },
    pullDownRefresh() {
      uni.startPullDownRefresh({
        success() {
          setTimeout(() => {
            uni.stopPullDownRefresh()
          }, 1000)
        },
      })
    },
    scrollToBottom() {
      uni.pageScrollTo({
        scrollTop: 2000,
      })
    },
  },
DCloud-WZF's avatar
DCloud-WZF 已提交
85 86 87 88 89 90 91 92
}
</script>

<style>
.container {
  height: 1200px;
}
</style>