列表滚动加载

This commit is contained in:
WangHao 2020-10-02 13:11:01 +08:00
parent d35593e8e9
commit 31a351e1e4

View File

@ -120,7 +120,7 @@
</el-row> </el-row>
<p v-if="listloading" class="listhint"><i class="el-icon-loading"></i>加载中...</p> <p v-if="listloading" class="listhint"><i class="el-icon-loading"></i>加载中...</p>
<p v-if="noMore" class="listhint">没有更多了</p> <p v-if="listnoMore" class="listhint">没有更多了</p>
</div> </div>
@ -277,7 +277,9 @@
height: "", height: "",
}, },
listloading: false,// listloading: false,//
datalistcount:500, listnoMore: false,
total:0,//
noMore:false,//
} }
}, },
@ -294,13 +296,7 @@
}, },
computed:{ computed:{
/**list加载完毕就禁止滚动**/ /**list加载完毕就禁止滚动**/
noMore() {
console.log(this.bookmarkList.length)
console.log(this.datalistcount)
// return this.bookmarkList.length >= this.datalistcount;
//TRUE
return false;
},
/**是否禁用滚动**/ /**是否禁用滚动**/
disabled(){ disabled(){
return this.listloading || this.noMore return this.listloading || this.noMore
@ -355,9 +351,31 @@
/**滚动监控**/ /**滚动监控**/
load() { load() {
//
this.queryParams.pageNum=this.queryParams.pageNum+1;
if (this.queryParams.pageNum*this.queryParams.pageSize>=this.total){
//
this.noMore=true;
this.listnoMore=true;
return;
}
this.listloading = true this.listloading = true
this.bookmarkList = this.bookmarkList.concat(this.bookmarkList, this.bookmarkList); setTimeout(() =>{
this.listloading = false selectBymenuIdUserID(this.queryParams).then(response => {
if (response.rows.length!=0 && response.code == 200) {
this.bookmarkList = this.bookmarkList.concat(this.bookmarkList, response.rows);
this.total = response.total;
this.listloading = false
} else {
//
this.noMore=true;
this.listloading = false
}
});
},1000);
}, },
/**切换显示 全部 网页 文本 其他**/ /**切换显示 全部 网页 文本 其他**/
@ -553,7 +571,7 @@
/**编辑标签 开始**/ /**编辑标签 开始**/
.el-tag + .el-tag { .el-tag {
margin-left: 10px; margin-left: 10px;
} }