From cfbc5802e450270ee6fc708f3eb2593132e1832c Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 19 Apr 2024 13:56:57 +0800 Subject: [PATCH] fix VInfiniteScroll --- src/components/dialog/SubscribeHistoryDialog.vue | 8 ++++---- src/views/discover/MediaCardListView.vue | 8 +++++--- src/views/discover/PersonCardListView.vue | 5 +++-- src/views/system/MessageView.vue | 8 ++++++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/components/dialog/SubscribeHistoryDialog.vue b/src/components/dialog/SubscribeHistoryDialog.vue index 7622e984..fe1f2e60 100644 --- a/src/components/dialog/SubscribeHistoryDialog.vue +++ b/src/components/dialog/SubscribeHistoryDialog.vue @@ -57,7 +57,7 @@ async function loadHistory({ done }: { done: any }) { isRefreshed.value = true if (currData.value.length === 0) { // 如果没有数据,跳出 - done('error') + done('empty') } else { // 合并数据 historyList.value = [...historyList.value, ...currData.value] @@ -156,6 +156,9 @@ const dropdownItems = ref([ + - - 没有数据 - diff --git a/src/views/discover/MediaCardListView.vue b/src/views/discover/MediaCardListView.vue index 877205cc..1992c54a 100644 --- a/src/views/discover/MediaCardListView.vue +++ b/src/views/discover/MediaCardListView.vue @@ -71,13 +71,15 @@ async function fetchData({ done }: { done: any }) { isRefreshed.value = true if (currData.value.length === 0) { // 如果没有数据,跳出 - done('error') + done('empty') return } // 合并数据 dataList.value = [...dataList.value, ...currData.value] // 页码+1 page.value++ + // 返回加载成功 + done('ok') } } else { @@ -92,7 +94,7 @@ async function fetchData({ done }: { done: any }) { isRefreshed.value = true if (currData.value.length === 0) { // 如果没有数据,跳出 - done('error') + done('empty') } else { // 合并数据 dataList.value = [...dataList.value, ...currData.value] @@ -107,7 +109,6 @@ async function fetchData({ done }: { done: any }) { } catch (error) { console.error(error) - // 返回加载失败 done('error') } @@ -127,6 +128,7 @@ async function fetchData({ done }: { done: any }) { @load="fetchData" >