24 Star 152 Fork 4

jry / uview-plus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
list.nvue 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
jry 提交于 2024-04-09 14:48 . 示例中u-前缀统一为up-
<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>
1
https://gitee.com/jry/uview-plus.git
git@gitee.com:jry/uview-plus.git
jry
uview-plus
uview-plus
master

搜索帮助