From 80b72c43b615d6b7a7f12246eb677fa3b7fa148b Mon Sep 17 00:00:00 2001 From: hakadao Date: Tue, 2 Apr 2024 01:04:00 +0800 Subject: [PATCH] fix(Trending): resolve the infinite data retrieval issus (#445) --- src/contentScripts/views/Home/components/Trending.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/contentScripts/views/Home/components/Trending.vue b/src/contentScripts/views/Home/components/Trending.vue index 760f8a1c..95a193e6 100644 --- a/src/contentScripts/views/Home/components/Trending.vue +++ b/src/contentScripts/views/Home/components/Trending.vue @@ -24,6 +24,7 @@ const videoList = reactive([]) const isLoading = ref(false) const containerRef = ref() as Ref const pn = ref(1) +const noMoreContent = ref(false) const { handleReachBottom, handlePageRefresh } = useBewlyApp() onMounted(async () => { @@ -36,6 +37,7 @@ onActivated(() => { }) async function initData() { + noMoreContent.value = false videoList.length = 0 pn.value = 1 await getData() @@ -57,6 +59,9 @@ function initPageAction() { } async function getTrendingVideos() { + if (noMoreContent.value) + return + emit('beforeLoading') isLoading.value = true try { @@ -66,7 +71,9 @@ async function getTrendingVideos() { ps: 30, }) - if (response.code === 0 && !response.data.no_more) { + if (response.code === 0) { + noMoreContent.value = response.data.no_more + const resData = [] as VideoItem[] response.data.list.forEach((item: VideoItem) => {