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