Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
01276871
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
369
Star
3
Fork
8
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
01276871
编写于
4月 22, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(lifecycle): 优化生命周期示例
上级
ba324ee1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
431 addition
and
158 deletion
+431
-158
components/CompositionAPILifecycle.uvue
components/CompositionAPILifecycle.uvue
+191
-94
components/OptionsAPILifecycle.uvue
components/OptionsAPILifecycle.uvue
+114
-55
pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.uvue
...pi/lifecycle/component-lifecycle/component-lifecycle.uvue
+3
-3
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.uvue
...position-api/lifecycle/page-lifecycle/page-lifecycle.uvue
+60
-2
pages/lifecycle/component/component.uvue
pages/lifecycle/component/component.uvue
+1
-2
pages/lifecycle/page/page.uvue
pages/lifecycle/page/page.uvue
+62
-2
未找到文件。
components/CompositionAPILifecycle.uvue
浏览文件 @
01276871
<template>
<template>
title: {{ title }}
title: {{ title }}
<view class="uni-common-mt item-container">
<text>onLoad 触发:</text>
<text>{{ isOnloadTriggered }}</text>
</view>
<view class="item-container">
<text>onPageShow 触发:</text>
<text>{{ isOnShowTriggered }}</text>
</view>
<view class="item-container">
<text>onReady 触发:</text>
<text>{{ isOnReadyTriggered }}</text>
</view>
<view class="item-container">
<text>onBeforeMount 触发:</text>
<text>{{ isOnBeforeMountTriggered }}</text>
</view>
<view class="item-container">
<text>onMounted 触发:</text>
<text>{{ isOnMountedTriggered }}</text>
</view>
<view class="item-container">
<text>onBeforeUpdate 触发:</text>
<text>{{ isOnBeforeUpdateTriggered }}</text>
</view>
<view class="item-container">
<text>onUpdated 触发:</text>
<text>{{ isOnUpdatedTriggered }}</text>
</view>
<view class="item-container">
<text>onBeforeUnmount 触发:</text>
<text>{{ isOnBeforeUnmountTriggered }}</text>
</view>
<view class="item-container">
<text>onUnmounted 触发:</text>
<text>{{ isOnUnmountedTriggered }}</text>
</view>
<view class="item-container">
<text>onPullDownRefresh 触发:</text>
<text>{{ isOnPullDownRefreshTriggered }}</text>
</view>
<view class="item-container">
<text>onReachBottom 触发:</text>
<text>{{ isOnReachBottomTriggered }}</text>
</view>
<view class="item-container">
<text>onBackPress 触发:</text>
<text>{{ isOnBackPressTriggered }}</text>
</view>
<view class="item-container">
<text>onPageHide 触发:</text>
<text>{{ isOnHideTriggered }}</text>
</view>
<view class="item-container">
<text>onResize 触发:</text>
<text>{{ isOnResizeTriggered }}</text>
</view>
<button class="component-lifecycle-btn uni-common-mt" @click="updateTitle">
<button class="component-lifecycle-btn uni-common-mt" @click="updateTitle">
updateTitle
updateTitle
</button>
</button>
</template>
</template>
<script setup>
<script setup lang="uts">
import { state, setLifeCycleNum } from '../store/index.uts'
import { state, setLifeCycleNum } from '../store/index.uts'
const title = ref('component for composition API lifecycle test')
const title = ref('component for composition API lifecycle test')
const emit = defineEmits<{
const isOnloadTriggered = ref(false)
(e : 'updateIsScroll', val : boolean) : void
const isOnShowTriggered = ref(false)
}>()
const isOnReadyTriggered = ref(false)
const isOnPullDownRefreshTriggered = ref(false)
onLoad((_ : OnLoadOptions) => {
const isOnPageScrollTriggered = ref(false)
// 自动化测试
const isOnReachBottomTriggered = ref(false)
setLifeCycleNum(state.lifeCycleNum + 100)
const isOnBackPressTriggered = ref(false)
})
const isOnHideTriggered = ref(false)
onPageShow(() => {
const isOnResizeTriggered = ref(false)
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
const isOnBeforeMountTriggered = ref(false)
})
const isOnMountedTriggered = ref(false)
onReady(() => {
const isOnBeforeUpdateTriggered = ref(false)
// 自动化测试
const isOnUpdatedTriggered = ref(false)
// TODO: onReady 未触发
const isOnBeforeUnmountTriggered = ref(false)
setLifeCycleNum(state.lifeCycleNum + 10)
const isOnUnmountedTriggered = ref(false)
})
const emit = defineEmits<{
onPullDownRefresh(() => {
(e : 'updateIsScroll', val : boolean) : void
// 自动化测试
}>()
setLifeCycleNum(state.lifeCycleNum + 10)
})
onLoad((_ : OnLoadOptions) => {
onPageScroll((_) => {
isOnloadTriggered.value = true
// 自动化测试
// 自动化测试
emit('updateIsScroll', true)
setLifeCycleNum(state.lifeCycleNum + 100)
})
})
onReachBottom(() => {
onPageShow(() => {
// 自动化测试
isOnShowTriggered.value = true
setLifeCycleNum(state.lifeCycleNum + 10)
// 自动化测试
})
setLifeCycleNum(state.lifeCycleNum + 10)
onBackPress((_ : OnBackPressOptions) : boolean | null => {
})
// 自动化测试
onReady(() => {
setLifeCycleNum(state.lifeCycleNum - 10)
isOnReadyTriggered.value = true
return null
// 自动化测试
})
// TODO: onReady 未触发
onPageHide(() => {
setLifeCycleNum(state.lifeCycleNum + 10)
// 自动化测试
})
setLifeCycleNum(state.lifeCycleNum - 10)
})
onPullDownRefresh(() => {
onUnload(() => {
isOnPullDownRefreshTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 100)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
onPageScroll((_) => {
onBeforeMount(() => {
isOnPageScrollTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1)
emit('updateIsScroll', true)
console.log('component for lifecycle test mounted')
})
})
onReachBottom(() => {
isOnReachBottomTriggered.value = true
onMounted(() => {
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 1)
})
console.log('component for lifecycle test mounted')
onBackPress((_ : OnBackPressOptions) : boolean | null => {
})
isOnBackPressTriggered.value = true
// 自动化测试
onBeforeUpdate(() => {
setLifeCycleNum(state.lifeCycleNum - 10)
// 自动化测试
return null
setLifeCycleNum(state.lifeCycleNum + 1)
})
console.log('component for lifecycle test beforeUpdate')
onPageHide(() => {
})
isOnHideTriggered.value = true
// 自动化测试
onUpdated(() => {
setLifeCycleNum(state.lifeCycleNum - 10)
// 自动化测试
})
setLifeCycleNum(state.lifeCycleNum + 1)
onUnload(() => {
console.log('component for lifecycle test updated')
isOnHideTriggered.value = true
})
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 100)
onBeforeUnmount(() => {
})
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1)
onBeforeMount(() => {
console.log('component for lifecycle test beforeUnmount')
isOnBeforeMountTriggered.value = true
})
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1)
onUnmounted(() => {
console.log('component for lifecycle test mounted')
// 自动化测试
})
setLifeCycleNum(state.lifeCycleNum - 1)
console.log('component for lifecycle test unmounted')
onMounted(() => {
})
isOnMountedTriggered.value = true
// 自动化测试
// TODO: app-android 不触发
setLifeCycleNum(state.lifeCycleNum + 1)
onActivated(() => { })
console.log('component for lifecycle test mounted')
// TODO: app-android 不触发
})
onDeactivated(() => { })
onBeforeUpdate(() => {
const updateTitle = () => {
isOnBeforeUpdateTriggered.value = true
title.value = 'component for lifecycle test updated'
// 自动化测试
}
setLifeCycleNum(state.lifeCycleNum + 1)
</script>
console.log('component for lifecycle test beforeUpdate')
\ No newline at end of file
})
onUpdated(() => {
isOnUpdatedTriggered.value = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1)
console.log('component for lifecycle test updated')
})
onBeforeUnmount(() => {
isOnBeforeUnmountTriggered.value = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1)
console.log('component for lifecycle test beforeUnmount')
})
onUnmounted(() => {
isOnUnmountedTriggered.value = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1)
console.log('component for lifecycle test unmounted')
})
// TODO: app-android 不触发
onActivated(() => { })
// TODO: app-android 不触发
onDeactivated(() => { })
const updateTitle = () => {
title.value = 'component for lifecycle test updated'
}
</script>
<style>
.item-container {
margin-bottom: 10px;
display: flex;
justify-content: space-between;
flex-direction: row;
}
</style>
components/OptionsAPILifecycle.uvue
浏览文件 @
01276871
<template>
<template>
title: {{ title }}
title: {{ title }}
<view class="uni-common-mt item-container">
<text>beforeCreate 触发:</text>
<text>{{ isBeforeCreateTriggered }}</text>
</view>
<view class="item-container">
<text>created 触发:</text>
<text>{{ isCreatedTriggered }}</text>
</view>
<view class="item-container">
<text>beforeMount 触发:</text>
<text>{{ isBeforeMountTriggered }}</text>
</view>
<view class="item-container">
<text>mounted 触发:</text>
<text>{{ isMountedTriggered }}</text>
</view>
<view class="item-container">
<text>beforeUpdate 触发:</text>
<text>{{ isBeforeUpdateTriggered }}</text>
</view>
<view class="item-container">
<text>updated 触发:</text>
<text>{{ isUpdatedTriggered }}</text>
</view>
<view class="item-container">
<text>beforeUnmount 触发:</text>
<text>{{ isBeforeUnmountTriggered }}</text>
</view>
<view class="item-container">
<text>unmounted 触发:</text>
<text>{{ isUnmountedTriggered }}</text>
</view>
<button class="component-lifecycle-btn uni-common-mt" @click="updateTitle">
<button class="component-lifecycle-btn uni-common-mt" @click="updateTitle">
updateTitle
updateTitle
</button>
</button>
</template>
</template>
<script>
<script lang="uts">
import { state, setLifeCycleNum } from '../store/index.uts';
import { state, setLifeCycleNum } from '../store/index.uts';
export default {
export default {
name: 'OptionsAPIComponentLifecycle',
name: 'OptionsAPIComponentLifecycle',
data() {
data() {
return {
return {
title: 'component for options API lifecycle test',
title: 'component for options API lifecycle test',
};
isBeforeCreateTriggered: false,
isCreatedTriggered: false,
isBeforeMountTriggered: false,
isMountedTriggered: false,
isBeforeUpdateTriggered: false,
isUpdatedTriggered: false,
isBeforeUnmountTriggered: false,
isUnmountedTriggered: false,
};
},
beforeCreate() {
setTimeout(() => {
this.isBeforeCreateTriggered = true
}, 0);
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test beforeCreate');
},
created() {
this.isCreatedTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test created');
},
beforeMount() {
this.isBeforeMountTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test beforeMount');
},
mounted() {
this.isMountedTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test mounted');
},
beforeUpdate() {
this.isBeforeUpdateTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test beforeUpdate');
},
updated() {
this.isUpdatedTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test updated');
},
beforeUnmount() {
this.isBeforeUnmountTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1);
console.log('component for lifecycle test beforeUnmount');
},
unmounted() {
this.isUnmountedTriggered = true
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1);
console.log('component for lifecycle test unmounted');
},
methods: {
updateTitle() {
this.title = 'component for lifecycle test updated';
},
},
beforeCreate() {
},
// 自动化测试
};
setLifeCycleNum(state.lifeCycleNum + 1);
</script>
console.log('component for lifecycle test beforeCreate');
},
<style>
created() {
.item-container {
// 自动化测试
margin-bottom: 10px;
setLifeCycleNum(state.lifeCycleNum + 1);
display: flex;
console.log('component for lifecycle test created');
justify-content: space-between;
},
flex-direction: row;
beforeMount() {
}
// 自动化测试
</style>
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test beforeMount');
},
mounted() {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test mounted');
},
beforeUpdate() {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test beforeUpdate');
},
updated() {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1);
console.log('component for lifecycle test updated');
},
beforeUnmount() {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1);
console.log('component for lifecycle test beforeUnmount');
},
unmounted() {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1);
console.log('component for lifecycle test unmounted');
},
methods: {
updateTitle() {
this.title = 'component for lifecycle test updated';
},
},
};
</script>
\ No newline at end of file
pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.uvue
浏览文件 @
01276871
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
<!-- #ifdef APP -->
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<scroll-view style="flex:1">
<!-- #endif -->
<!-- #endif -->
<view class="pag container">
<view class="page container">
<text class="uni-common-mb">component lifecycle</text>
<component-lifecycle class="component-lifecycle" @updateIsScroll="updateIsScroll" />
<component-lifecycle class="component-lifecycle" @updateIsScroll="updateIsScroll" />
<button class="uni-common-mt" @click="scrollToBottom">scrollToBottom</button>
<button class="uni-common-mt" @click="scrollToBottom">scrollToBottom</button>
<button class="uni-common-mt" @click="pullDownRefresh">trigger pullDownRefresh</button>
</view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
</scroll-view>
</scroll-view>
<!-- #endif -->
<!-- #endif -->
</template>
</template>
<script setup>
<script setup
lang='uts'
>
import ComponentLifecycle from '@/components/CompositionAPILifecycle.uvue'
import ComponentLifecycle from '@/components/CompositionAPILifecycle.uvue'
import { state, setLifeCycleNum } from '@/store/index.uts'
import { state, setLifeCycleNum } from '@/store/index.uts'
...
...
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.uvue
浏览文件 @
01276871
...
@@ -3,49 +3,100 @@
...
@@ -3,49 +3,100 @@
<scroll-view style="flex:1" :bounces="false">
<scroll-view style="flex:1" :bounces="false">
<!-- #endif -->
<!-- #endif -->
<view class="page container">
<view class="page container">
<text>page lifecycle</text>
<view class="item-container">
<text>onLoad 触发:</text>
<text>{{ isOnloadTriggered }}</text>
</view>
<view class="item-container">
<text>onShow 触发:</text>
<text>{{ isOnShowTriggered }}</text>
</view>
<view class="item-container">
<text>onReady 触发:</text>
<text>{{ isOnReadyTriggered }}</text>
</view>
<view class="item-container">
<text>onPullDownRefresh 触发:</text>
<text>{{ isOnPullDownRefreshTriggered }}</text>
</view>
<view class="item-container">
<text>onReachBottom 触发:</text>
<text>{{ isOnReachBottomTriggered }}</text>
</view>
<view class="item-container">
<text>onBackPress 触发:</text>
<text>{{ isOnBackPressTriggered }}</text>
</view>
<view class="item-container">
<text>onHide 触发:</text>
<text>{{ isOnHideTriggered }}</text>
</view>
<view class="item-container">
<text>onResize 触发:</text>
<text>{{ isOnResizeTriggered }}</text>
</view>
<button class="uni-common-mt" @click="scrollToBottom">scrollToBottom</button>
<button class="uni-common-mt" @click="scrollToBottom">scrollToBottom</button>
<button class="uni-common-mt" @click="pullDownRefresh">
trigger pullDownRefresh
</button>
</view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
</scroll-view>
</scroll-view>
<!-- #endif -->
<!-- #endif -->
</template>
</template>
<script setup>
<script setup
lang='uts'
>
import { state, setLifeCycleNum } from '@/store/index.uts'
import { state, setLifeCycleNum } from '@/store/index.uts'
const isScrolled = ref(false)
const isScrolled = ref(false)
const isOnloadTriggered = ref(false)
const isOnShowTriggered = ref(false)
const isOnReadyTriggered = ref(false)
const isOnPullDownRefreshTriggered = ref(false)
const isOnPageScrollTriggered = ref(false)
const isOnReachBottomTriggered = ref(false)
const isOnBackPressTriggered = ref(false)
const isOnHideTriggered = ref(false)
const isOnResizeTriggered = ref(false)
onLoad((_: OnLoadOptions) => {
onLoad((_: OnLoadOptions) => {
isOnloadTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 100)
setLifeCycleNum(state.lifeCycleNum + 100)
})
})
onPageShow(() => {
onPageShow(() => {
isOnShowTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
onReady(() => {
onReady(() => {
isOnReadyTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
onPullDownRefresh(() => {
onPullDownRefresh(() => {
isOnPullDownRefreshTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
onPageScroll((_) => {
onPageScroll((_) => {
isOnPageScrollTriggered.value = true
// 自动化测试
// 自动化测试
isScrolled.value = true
isScrolled.value = true
})
})
onReachBottom(() => {
onReachBottom(() => {
isOnReachBottomTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
onBackPress((_: OnBackPressOptions): boolean | null => {
onBackPress((_: OnBackPressOptions): boolean | null => {
isOnBackPressTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
setLifeCycleNum(state.lifeCycleNum - 10)
return null
return null
})
})
onPageHide(() => {
onPageHide(() => {
isOnPageHideTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
setLifeCycleNum(state.lifeCycleNum - 10)
})
})
...
@@ -54,6 +105,7 @@
...
@@ -54,6 +105,7 @@
setLifeCycleNum(state.lifeCycleNum - 100)
setLifeCycleNum(state.lifeCycleNum - 100)
})
})
onResize((_) => {
onResize((_) => {
isOnResizeTriggered.value = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
})
})
...
@@ -102,4 +154,10 @@
...
@@ -102,4 +154,10 @@
.container {
.container {
height: 1200px;
height: 1200px;
}
}
.item-container {
margin-bottom: 10px;
display: flex;
justify-content: space-between;
flex-direction: row;
}
</style>
</style>
\ No newline at end of file
pages/lifecycle/component/component.uvue
浏览文件 @
01276871
<template>
<template>
<view class="page">
<view class="page">
<text class="uni-common-mb">component lifecycle</text>
<component-lifecycle class="component-lifecycle" />
<component-lifecycle class="component-lifecycle" />
</view>
</view>
</template>
</template>
<script>
<script
lang="uts"
>
import ComponentLifecycle from '@/components/OptionsAPILifecycle.uvue'
import ComponentLifecycle from '@/components/OptionsAPILifecycle.uvue'
import { state } from '@/store/index.uts'
import { state } from '@/store/index.uts'
export default {
export default {
...
...
pages/lifecycle/page/page.uvue
浏览文件 @
01276871
...
@@ -3,8 +3,44 @@
...
@@ -3,8 +3,44 @@
<scroll-view style="flex: 1" :bounces="false">
<scroll-view style="flex: 1" :bounces="false">
<!-- #endif -->
<!-- #endif -->
<view class="page container">
<view class="page container">
<text>page lifecycle</text>
<view class="item-container">
<button class="uni-common-mt" @click="scrollToBottom">scrollToBottom</button>
<text>onLoad 触发:</text>
<text>{{ isOnloadTriggered }}</text>
</view>
<view class="item-container">
<text>onShow 触发:</text>
<text>{{ isOnShowTriggered }}</text>
</view>
<view class="item-container">
<text>onReady 触发:</text>
<text>{{ isOnReadyTriggered }}</text>
</view>
<view class="item-container">
<text>onPullDownRefresh 触发:</text>
<text>{{ isOnPullDownRefreshTriggered }}</text>
</view>
<view class="item-container">
<text>onReachBottom 触发:</text>
<text>{{ isOnReachBottomTriggered }}</text>
</view>
<view class="item-container">
<text>onBackPress 触发:</text>
<text>{{ isOnBackPressTriggered }}</text>
</view>
<view class="item-container">
<text>onHide 触发:</text>
<text>{{ isOnHideTriggered }}</text>
</view>
<view class="item-container">
<text>onResize 触发:</text>
<text>{{ isOnResizeTriggered }}</text>
</view>
<button class="uni-common-mt" @click="scrollToBottom">
scrollToBottom
</button>
<button class="uni-common-mt" @click="pullDownRefresh">
trigger pullDownRefresh
</button>
</view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
</scroll-view>
</scroll-view>
...
@@ -18,38 +54,55 @@ export default {
...
@@ -18,38 +54,55 @@ export default {
data() {
data() {
return {
return {
isScrolled: false,
isScrolled: false,
isOnloadTriggered: false,
isOnShowTriggered: false,
isOnReadyTriggered: false,
isOnPullDownRefreshTriggered: false,
isOnPageScrollTriggered: false,
isOnReachBottomTriggered: false,
isOnBackPressTriggered: false,
isOnHideTriggered: false,
isOnResizeTriggered: false,
}
}
},
},
onLoad(_ : OnLoadOptions) {
onLoad(_ : OnLoadOptions) {
this.isOnloadTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 100)
setLifeCycleNum(state.lifeCycleNum + 100)
},
},
onShow() {
onShow() {
this.isOnShowTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
},
},
onReady() {
onReady() {
this.isOnReadyTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
},
},
onPullDownRefresh() {
onPullDownRefresh() {
this.isOnPullDownRefreshTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
},
},
onPageScroll(_) {
onPageScroll(_) {
this.isOnPageScrollTriggered = true
// 自动化测试
// 自动化测试
this.isScrolled = true
this.isScrolled = true
},
},
onReachBottom() {
onReachBottom() {
this.isOnReachBottomTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
},
},
onBackPress(_ : OnBackPressOptions) : boolean | null {
onBackPress(_ : OnBackPressOptions) : boolean | null {
this.isOnBackPressTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
setLifeCycleNum(state.lifeCycleNum - 10)
return null
return null
},
},
onHide() {
onHide() {
this.isOnHideTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
setLifeCycleNum(state.lifeCycleNum - 10)
},
},
...
@@ -58,6 +111,7 @@ export default {
...
@@ -58,6 +111,7 @@ export default {
setLifeCycleNum(state.lifeCycleNum - 100)
setLifeCycleNum(state.lifeCycleNum - 100)
},
},
onResize(_){
onResize(_){
this.isOnResizeTriggered = true
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
setLifeCycleNum(state.lifeCycleNum + 10)
},
},
...
@@ -94,4 +148,10 @@ export default {
...
@@ -94,4 +148,10 @@ export default {
.container {
.container {
height: 1200px;
height: 1200px;
}
}
.item-container {
margin-bottom: 10px;
display: flex;
justify-content: space-between;
flex-direction: row;
}
</style>
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录