chore: lgfm

This commit is contained in:
Hakadao
2023-07-19 01:32:13 +08:00
parent d6c3b42f3b
commit 6191e17d69
5 changed files with 19 additions and 12 deletions

View File

@@ -6,7 +6,6 @@ import AnimeCardSkeleton from './components/AnimeCardSkeleton.vue'
import type { AnimeItem, PopularAnime } from './types'
import { getUserID, openLinkToNewTab } from '~/utils/main'
import { numFormatter } from '~/utils/dataFormatter'
import { settings } from '~/logic'
import emitter from '~/utils/mitt'
const animeWatchList = reactive<AnimeItem[]>([])
@@ -23,6 +22,7 @@ onMounted(() => {
getPopularAnimeList()
getRecommendAnimeList()
emitter.off('reachBottom')
emitter.on('reachBottom', () => {
if (!isLoadingRecommendAnime.value)
getRecommendAnimeList()
@@ -30,8 +30,7 @@ onMounted(() => {
})
onUnmounted(() => {
// remove the global window.onscroll event
window.onscroll = () => {}
emitter.off('reachBottom')
})
function getAnimeWatchList() {

View File

@@ -110,8 +110,11 @@ onMounted(() => {
if (
mainAppRef.value.clientHeight + mainAppRef.value.scrollTop
>= mainAppRef.value.scrollHeight - 20
)
emitter.emit('reachBottom')
) {
nextTick(() => {
emitter.emit('reachBottom')
})
}
if (mainAppRef.value.scrollTop === 0)
showTopbarMask.value = false

View File

@@ -36,6 +36,7 @@ onMounted(() => {
getHistoryList()
getHistoryPauseStatus()
emitter.off('reachBottom')
emitter.on('reachBottom', () => {
if (isLoading.value)
return
@@ -48,6 +49,10 @@ onMounted(() => {
})
})
onUnmounted(() => {
emitter.off('reachBottom')
})
/**
* Get history list
*/

View File

@@ -33,19 +33,24 @@ onMounted(async () => {
}
}, 200)
emitter.off('reachBottom')
emitter.on('reachBottom', () => {
if (!isLoading.value) {
if (settings.value.recommendationMode === 'web') {
getRecommendVideos()
}
else {
for (let i = 0; i < 3; i++)
getAppRecommendVideos()
// for (let i = 0; i < 3; i++)
getAppRecommendVideos()
}
}
})
})
onUnmounted(() => {
emitter.off('reachBottom')
})
async function getRecommendVideos() {
isLoading.value = true
try {

View File

@@ -15,11 +15,6 @@ onMounted(() => {
getAllWatchLaterList()
})
onUnmounted(() => {
// remove the global window.onscroll event
window.onscroll = () => {}
})
/**
* Get watch later list
*/