/
list.nvue
68 lines (66 loc) · 1.44 KB
/
list.nvue
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
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<view class="u-page">
<up-list
@scrolltolower="scrolltolower"
>
<up-list-item
v-for="(item, index) in indexList"
:key="index"
>
<up-cell
:title="`列表长度-${index + 1}`"
>
<template #icon>
<up-avatar
shape="square"
size="35"
:src="item.url"
customStyle="margin: -3px 5px -3px 0"
></up-avatar>
</template>
</up-cell>
</up-list-item>
</up-list>
</view>
</template>
<script>
export default {
data() {
return {
indexList: [],
urls: [
'https://cdn.uviewui.com/uview/album/1.jpg',
'https://cdn.uviewui.com/uview/album/2.jpg',
'https://cdn.uviewui.com/uview/album/3.jpg',
'https://cdn.uviewui.com/uview/album/4.jpg',
'https://cdn.uviewui.com/uview/album/5.jpg',
'https://cdn.uviewui.com/uview/album/6.jpg',
'https://cdn.uviewui.com/uview/album/7.jpg',
'https://cdn.uviewui.com/uview/album/8.jpg',
'https://cdn.uviewui.com/uview/album/9.jpg',
'https://cdn.uviewui.com/uview/album/10.jpg',
]
}
},
onLoad() {
this.loadmore()
},
methods: {
scrolltolower() {
this.loadmore()
},
loadmore() {
for (let i = 0; i < 30; i++) {
this.indexList.push({
url: this.urls[uni.$u.random(0, this.urls.length - 1)]
})
}
}
},
}
</script>
<style lang="scss">
.u-page {
padding: 0;
}
</style>