提交 4aeed860 编写于 作者: shutao-dc's avatar shutao-dc

添加 list-view-multiplex.nvue 测试list-item部分复用场景

上级 121de3aa
describe('component-native-list-view', () => {
let page
beforeAll(async () => {
//打开list-view-multiplex测试页
page = await program.reLaunch('/pages/component/list-view/list-view-multiplex')
await page.waitFor('list-view')
})
//滚动list-view到底部 加载更多 如果异常则直接闪退
it('check_list_item_multiplex', async () => {
await page.callMethod('listViewScrollByY', 5000)
await page.waitFor(400)
await page.callMethod('listViewScrollByY', 100)
})
})
<template>
<list-view id="listview" style="flex: 1;" @scrolltolower="onScrollTolower">
<list-item v-for="index in item_count" class="item">
<text >item-------<text>{{index}}</text></text>
</list-item>
</list-view>
</template>
<script>
export default {
data() {
return {
item_count: 20,
listViewElement: null as UniListViewElement|null
}
},
onReady() {
this.listViewElement = uni.getElementById<UniListViewElement>('listview')
},
methods: {
onScrollTolower(_: ScrollToLowerEvent) {
setTimeout(function(){
this.item_count += 20
}, 300)
},
//用于自动化测试
listViewScrollByY(y : number) {
this.listViewElement?.scrollBy(0, y)
}
}
}
</script>
<style>
.item {
padding: 15px;
margin: 5px 0;
background-color: #fff;
border-radius: 5px;
}
</style>
......@@ -169,6 +169,13 @@
<input-data defaultValue="#FFF" title="设置下拉刷新区域背景颜色" type="text"
@confirm="confirm_refresher_background_input"></input-data>
<enum-data :items="size_enum" title="通过id位置跳转" @change="item_change_size_enum"></enum-data>
<navigator url="/pages/component/list-view/list-view-multiplex" hover-class="none">
<button type="primary" class="button default-button">
list-view 对list-item复用测试
</button>
</navigator>
</view>
<!-- #ifdef APP -->
</scroll-view>
......@@ -192,12 +199,12 @@
align-items: center;
justify-content: center;
}
.tip-text {
color: #888;
font-size: 12px;
}
.refresh-box {
justify-content: center;
align-items: center;
......@@ -205,4 +212,8 @@
height: 45px;
width: 100%;
}
.button {
margin-top: 30rpx;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册