代码拉取完成,页面将自动刷新
<template>
<view class="u-page">
<u-list
@scrolltolower="scrolltolower"
>
<u-list-item
v-for="(item, index) in indexList"
:key="index"
>
<u-cell
:title="`列表长度-${index + 1}`"
>
<u-avatar
slot="icon"
shape="square"
size="35"
:src="item.url"
customStyle="margin: -3px 5px -3px 0"
></u-avatar>
</u-cell>
</u-list-item>
</u-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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。