fix: page refresh not reset page num

This commit is contained in:
starknt
2024-01-11 17:21:45 +08:00
parent 7940f32e35
commit 0d1735ab87

View File

@@ -24,13 +24,16 @@ const { handlePageRefresh, handleReachBottom } = useBewlyApp()
const isLoading = ref<boolean>(true)
const isFullPageLoading = ref<boolean>(false)
const noMoreContent = ref<boolean>()
const noMoreContentWarning = ref<boolean>(false)
function initPageAction() {
handleReachBottom.value = async () => {
if (isLoading.value)
return
if (noMoreContent.value)
if (noMoreContent.value) {
noMoreContentWarning.value = true
return
}
await getFavoriteResources(selectedCategory.value!.id, ++currentPageNum.value, keyword.value)
}
@@ -38,6 +41,7 @@ function initPageAction() {
if (isLoading.value)
return
favoriteResources.length = 0
currentPageNum.value = 1
handleSearch()
}
}
@@ -236,6 +240,9 @@ function handleUnfavorite(favoriteResource: FavoriteResource) {
</TransitionGroup>
</div>
<!-- no more content -->
<Empty v-if="noMoreContentWarning" class="py-4" :description="$t('common.no_more_content')" />
<!-- loading -->
<Transition name="fade">
<Loading