Vant中List列表下拉加载更多
Posted iwishicould
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vant中List列表下拉加载更多相关的知识,希望对你有一定的参考价值。
van-list上只有一层父级元素div,多了可能下拉加载出不来;或者更多
<template>
<div class="scholl-declarepage">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
:immediate-check="cheack"
>
<swipe-cell
custom
class="bootom-having-border"
:isEdit="isEdit"
v-for="(item,index) in listAchool" :key="index"
@edit="detior(item)"
@remove="delItem(item)"
>
<scholl-list-com :listObj="item" @gotodetails="gotodetails(item)"></scholl-list-com>
</swipe-cell>
</van-list>
</div>
</template>
loading: false,
finished: false,
cheack:true,
paramsList:{
orgId: "",
pageIndex: 0,
pageSize: 10
},
listAchool:[],
onLoad(){
this.paramsList.pageIndex+=1;
this.schoolListContApi();//列表渲染
},
schoolListContApi(){
this.paramsList.orgId=this.userInfo.orgId,
schoolListCont(this.paramsList).then(res=>{
console.log(res);
if(res.success==true){
this.loading = false;// 这一次的加载状态结束
this.listAchool=this.listAchool.concat(res.data);
if(res.data.length==0 || this.listAchool.length>=res.totalDatas){
this.finished = true;//所有的数据已经全部加载完了
}else{
this.finished = false;
}
}else{
this.finished = false;
}
})
},
// 删除请求
commendDelApi(item){
let params={
id:item.id
}
schoolDelCont(params).then(res=>{
if(res.success==true){
this.paramsList.pageIndex=1;//重新赋值
this.listAchool=[];
this.schoolListContApi();
}
})
},
以上是关于Vant中List列表下拉加载更多的主要内容,如果未能解决你的问题,请参考以下文章