<template>
<view>
<view v-for="(item,index) in list" :key="index"></view>
<view class="loadingText">{
{loadingText}}</view>
</view>
</template>
<script>
export default {
data() {
return {
list: []
page: 1,
loadingText: '上拉显示更多'
}
},
onLoad(options) {
this.getList()
},
onPullDownRefresh() {
this.page = 1
this.getList()
},
onReachBottom() {
this.getMoreList();
},
methods: {
getList() {
this.$agreementApi.getList(this.page, this.pageSize).then(res => {
if (res.code == 0) {
this.list = res.data.data;
uni.stopPullDownRefresh()
this.page++
}
});
},
getMoreList() {
this.loadingText = '-- 正在加载 --'
this.$agreementApi.getList(this.page, this.pageSize).then(res => {
if (res.code == 0) {
if (res.data.data.len
uniapp滚动分页
最新推荐文章于 2024-07-26 10:53:22 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)