update @下拉刷新 优化
This commit is contained in:
parent
7ae20272b2
commit
7ce35e0f79
|
@ -1,12 +1,13 @@
|
|||
<template>
|
||||
<van-loading v-if="loadingStatus" class="pageNoneLoading_Vant" size="24px" color="#0094ff" vertical>加载中...</van-loading>
|
||||
<div v-else class="orderListBody">
|
||||
<div v-if="!listData.length" class="noneBox">
|
||||
<img class="noneImg" :src="require('./img/order-empty.png')" alt="">
|
||||
<p class="noneText">暂无订单</p>
|
||||
</div>
|
||||
<van-pull-refresh v-else class="refreshBody" v-model="refreshLoading" @refresh="onRefresh">
|
||||
<van-pull-refresh class="refreshBody" v-model="refreshLoading" @refresh="onRefresh">
|
||||
<div v-if="!listData.length" class="noneBox">
|
||||
<img class="noneImg" :src="require('./img/order-empty.png')" alt="">
|
||||
<p class="noneText">暂无订单</p>
|
||||
</div>
|
||||
<van-list
|
||||
v-else
|
||||
class="listBox"
|
||||
v-model:loading="loading"
|
||||
:finished="finished"
|
||||
|
@ -132,11 +133,12 @@ export default {
|
|||
if (res.data.orders.length < this.pageSize) {
|
||||
this.finished = true;
|
||||
}
|
||||
this.listData = [ ...this.listData, ...res.data.orders ];
|
||||
return this.listData = [ ...this.listData, ...res.data.orders ];
|
||||
} else {
|
||||
this.finished = true;
|
||||
}
|
||||
} else {
|
||||
this.refreshLoading = false;
|
||||
showToast(res?.message || '请求失败');
|
||||
}
|
||||
},
|
||||
|
@ -144,8 +146,10 @@ export default {
|
|||
this.page = 1;
|
||||
this.finished = false;
|
||||
this.loading = true;
|
||||
await this.getData();
|
||||
showToast('刷新成功');
|
||||
const list = await this.getData();
|
||||
if (list && list.length) {
|
||||
showToast('刷新成功');
|
||||
}
|
||||
},
|
||||
async onLoad() {
|
||||
this.page++;
|
||||
|
@ -189,6 +193,7 @@ export default {
|
|||
}
|
||||
}
|
||||
.refreshBody {
|
||||
min-height: 80vh;
|
||||
.listBox {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
|
|
Loading…
Reference in New Issue