remove defer

This commit is contained in:
jxxghp
2024-06-06 14:07:25 +08:00
parent 9f5859ee93
commit 0ecc7dfead
3 changed files with 9 additions and 28 deletions

View File

@@ -2,7 +2,6 @@
import _ from 'lodash'
import type { Context } from '@/api/types'
import TorrentCard from '@/components/cards/TorrentCard.vue'
import { useDefer } from '@/@core/utils/dom'
interface SearchTorrent extends Context {
more?: Array<Context>
@@ -73,13 +72,13 @@ const sortSeasonFilterOptions = computed(() => {
return seasonFilterOptions.value.sort((a, b) => {
// 按季,集降序排序
const parseSeasonEpisode = (str: string) => {
const seasonRangeMatch = str.match(/S(\d+)(?:-S(\d+))?/);
const episodeRangeMatch = str.match(/E(\d+)(?:-E(\d+))?/);
const seasonRangeMatch = str.match(/S(\d+)(?:-S(\d+))?/)
const episodeRangeMatch = str.match(/E(\d+)(?:-E(\d+))?/)
return {
seasonStart : seasonRangeMatch?.[1] ? parseInt(seasonRangeMatch[1]) : 0,
seasonEnd : seasonRangeMatch?.[2] ? parseInt(seasonRangeMatch[2]) : 0,
episodeStart : episodeRangeMatch?.[1] ? parseInt(episodeRangeMatch[1]) : 0,
episodeEnd : episodeRangeMatch?.[2] ? parseInt(episodeRangeMatch[2]) : 0
seasonStart: seasonRangeMatch?.[1] ? parseInt(seasonRangeMatch[1]) : 0,
seasonEnd: seasonRangeMatch?.[2] ? parseInt(seasonRangeMatch[2]) : 0,
episodeStart: episodeRangeMatch?.[1] ? parseInt(episodeRangeMatch[1]) : 0,
episodeEnd: episodeRangeMatch?.[2] ? parseInt(episodeRangeMatch[2]) : 0,
}
}
const parsedA = parseSeasonEpisode(a)
@@ -126,8 +125,6 @@ onMounted(() => {
groupedDataList.value = groupMap
})
let defer = (_: number) => true
// 计算过滤后的列表
watchEffect(() => {
// 清空列表
@@ -139,10 +136,7 @@ watchEffect(() => {
groupedDataList.value?.forEach(value => {
if (value.length > 0) {
const matchData = value.filter(data => {
const {
meta_info,
torrent_info,
} = data
const { meta_info, torrent_info } = data
// 季、制作组、视频编码
return (
// 站点过滤
@@ -169,7 +163,6 @@ watchEffect(() => {
}
}
})
defer = useDefer(dataList.value.length)
})
</script>
@@ -257,7 +250,7 @@ watchEffect(() => {
</VCard>
<div class="grid gap-3 grid-torrent-card items-start">
<div v-for="(item, index) in dataList" :key="`${index}_${item.torrent_info.title}_${item.torrent_info.site}`">
<TorrentCard v-if="defer(index)" :torrent="item" :more="item.more" />
<TorrentCard :torrent="item" :more="item.more" />
</div>
</div>
</template>

View File

@@ -1,7 +1,6 @@
<script lang="ts" setup>
import type { Context } from '@/api/types'
import TorrentItem from '@/components/cards/TorrentItem.vue'
import { useDefer } from '@/@core/utils/dom'
// 定义输入参数
const props = defineProps({

View File

@@ -8,7 +8,6 @@ import PluginCard from '@/components/cards/PluginCard.vue'
import noImage from '@images/logos/plugin.png'
import { useDisplay } from 'vuetify'
import { isNullOrEmptyObject } from '@/@core/utils'
import { useDefer } from '@/@core/utils/dom'
import router from '@/router'
import { PluginTabs } from '@/router/menu'
@@ -17,9 +16,6 @@ const route = useRoute()
// 显示器宽度
const display = useDisplay()
// 延迟加载
let deferApp = (_: number) => true
// 当前标签
const activeTab = ref(route.query.tab)
@@ -280,8 +276,6 @@ const sortedUninstalledList = computed(() => {
}
})
deferApp = useDefer(ret_list.length)
if (isNullOrEmptyObject(PluginStatistics.value)) return ret_list
// 数据排序
if (!activeSort.value || activeSort.value === 'count') {
@@ -418,12 +412,7 @@ onBeforeMount(async () => {
</div>
<div v-if="isAppMarketLoaded" class="grid gap-4 grid-plugin-card items-start">
<template v-for="(data, index) in sortedUninstalledList" :key="`${data.id}_v${data.plugin_version}`">
<PluginAppCard
v-if="deferApp(index)"
:plugin="data"
:count="PluginStatistics[data.id || '0']"
@install="pluginInstalled"
/>
<PluginAppCard :plugin="data" :count="PluginStatistics[data.id || '0']" @install="pluginInstalled" />
</template>
</div>
<NoDataFound