司机管理数据加载完之后显示没有更多数据

This commit is contained in:
2023-08-28 15:05:51 +08:00
parent d479170d27
commit 0959da27ba

View File

@ -1,5 +1,5 @@
<template>
<div class="wrap" @scroll="handleScroll">
<div class="wrap" >
<div class="navBar">
<van-nav-bar
title="司机管理"
@ -19,6 +19,12 @@
</van-nav-bar>
</div>
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<van-list
v-model="loading1"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div class="itemWrap" v-for="(item,index) in driverList" :key="index">
<div class="name-status">
<div class="namephone">{{ item.driverName }} / {{ item.driverPhone }}</div>
@ -46,6 +52,8 @@
<span :class="item.states?.code == 1 ? 'statusYes' : 'statusNo'">{{ item.states?.label }}</span>
</div>
</div>
</van-list>
</van-pull-refresh>
</div>
@ -68,6 +76,8 @@ export default {
supplierType:'',
count: 0,
isLoading: false,
loading1: false,
finished: false
}
},
mounted() {
@ -77,6 +87,16 @@ export default {
this.getDriverList()
},
methods:{
async onLoad(){
this.pageNum++;
await this.getDriverList()
// 加载状态结束
this.loading1 = false;
// 数据全部加载完成
if (this.driverList.length >= this.total) {
this.finished = true;
}
},
onRefresh() {
this.getDriverList()
setTimeout(() => {
@ -143,15 +163,15 @@ export default {
}
});
},
async handleScroll(){
let num = Math.ceil( this.total / 10)
if(num <= this.pageNum){
// console.log("不在加载数据")
}else{
this.pageNum++;
await this.getDriverList()
}
},
// async handleScroll(){
// let num = Math.ceil( this.total / 10)
// if(num <= this.pageNum){
// // console.log("不在加载数据")
// }else{
// this.pageNum++;
// await this.getDriverList()
// }
// },
}
}