mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix: page refresh reset action
This commit is contained in:
@@ -40,6 +40,8 @@ function initPageAction() {
|
||||
recommendAnimeList.length = 0
|
||||
popularAnimeList.length = 0
|
||||
cursor.value = 0
|
||||
noMoreContent.value = false
|
||||
noMoreContentWarning.value = false
|
||||
getAnimeWatchList()
|
||||
getPopularAnimeList()
|
||||
getRecommendAnimeList()
|
||||
|
||||
@@ -42,6 +42,8 @@ function initPageAction() {
|
||||
return
|
||||
favoriteResources.length = 0
|
||||
currentPageNum.value = 1
|
||||
noMoreContent.value = false
|
||||
noMoreContentWarning.value = false
|
||||
handleSearch()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ function initPageAction() {
|
||||
handlePageRefresh.value = () => {
|
||||
historyList.length = 0
|
||||
currentPageNum.value = 1
|
||||
noMoreContent.value = false
|
||||
noMoreContentWarning.value = false
|
||||
getHistoryList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,24 +13,34 @@ const needToLoginFirst = ref<boolean>(false)
|
||||
const containerRef = ref<HTMLElement>() as Ref<HTMLElement>
|
||||
const refreshIdx = ref<number>(1)
|
||||
const noMoreContent = ref<boolean>(false)
|
||||
const noMoreContentWarning = ref<boolean>(false)
|
||||
const { handleReachBottom, handlePageRefresh } = useBewlyApp()
|
||||
|
||||
function initPageAction() {
|
||||
handleReachBottom.value = async () => {
|
||||
if (!isLoading.value) {
|
||||
if (settings.value.recommendationMode === 'web') {
|
||||
getRecommendVideos()
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < 3; i++)
|
||||
await getAppRecommendVideos()
|
||||
}
|
||||
if (isLoading.value)
|
||||
return
|
||||
if (noMoreContent.value) {
|
||||
noMoreContentWarning.value = true
|
||||
return
|
||||
}
|
||||
if (settings.value.recommendationMode === 'web') {
|
||||
getRecommendVideos()
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < 3; i++)
|
||||
await getAppRecommendVideos()
|
||||
}
|
||||
}
|
||||
|
||||
handlePageRefresh.value = async () => {
|
||||
if (isLoading.value)
|
||||
return
|
||||
|
||||
videoList.length = 0
|
||||
appVideoList.length = 0
|
||||
noMoreContent.value = false
|
||||
noMoreContentWarning.value = false
|
||||
if (settings.value.recommendationMode === 'web') {
|
||||
await getRecommendVideos()
|
||||
}
|
||||
@@ -75,9 +85,6 @@ onActivated(() => {
|
||||
})
|
||||
|
||||
async function getRecommendVideos() {
|
||||
if (noMoreContent.value)
|
||||
return
|
||||
|
||||
isLoading.value = true
|
||||
try {
|
||||
const response: forYouResult = await browser.runtime.sendMessage({
|
||||
@@ -217,6 +224,9 @@ function jumpToLoginPage() {
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- no more content -->
|
||||
<Empty v-if="noMoreContentWarning" class="py-4" :description="$t('common.no_more_content')" />
|
||||
|
||||
<Transition name="fade">
|
||||
<Loading v-if="isLoading" />
|
||||
</Transition>
|
||||
|
||||
Reference in New Issue
Block a user