mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-12 16:01:35 +08:00
remove defer
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import type { Context } from '@/api/types'
|
import type { Context } from '@/api/types'
|
||||||
import TorrentCard from '@/components/cards/TorrentCard.vue'
|
import TorrentCard from '@/components/cards/TorrentCard.vue'
|
||||||
import { useDefer } from '@/@core/utils/dom'
|
|
||||||
|
|
||||||
interface SearchTorrent extends Context {
|
interface SearchTorrent extends Context {
|
||||||
more?: Array<Context>
|
more?: Array<Context>
|
||||||
@@ -73,13 +72,13 @@ const sortSeasonFilterOptions = computed(() => {
|
|||||||
return seasonFilterOptions.value.sort((a, b) => {
|
return seasonFilterOptions.value.sort((a, b) => {
|
||||||
// 按季,集降序排序
|
// 按季,集降序排序
|
||||||
const parseSeasonEpisode = (str: string) => {
|
const parseSeasonEpisode = (str: string) => {
|
||||||
const seasonRangeMatch = str.match(/S(\d+)(?:-S(\d+))?/);
|
const seasonRangeMatch = str.match(/S(\d+)(?:-S(\d+))?/)
|
||||||
const episodeRangeMatch = str.match(/E(\d+)(?:-E(\d+))?/);
|
const episodeRangeMatch = str.match(/E(\d+)(?:-E(\d+))?/)
|
||||||
return {
|
return {
|
||||||
seasonStart : seasonRangeMatch?.[1] ? parseInt(seasonRangeMatch[1]) : 0,
|
seasonStart: seasonRangeMatch?.[1] ? parseInt(seasonRangeMatch[1]) : 0,
|
||||||
seasonEnd : seasonRangeMatch?.[2] ? parseInt(seasonRangeMatch[2]) : 0,
|
seasonEnd: seasonRangeMatch?.[2] ? parseInt(seasonRangeMatch[2]) : 0,
|
||||||
episodeStart : episodeRangeMatch?.[1] ? parseInt(episodeRangeMatch[1]) : 0,
|
episodeStart: episodeRangeMatch?.[1] ? parseInt(episodeRangeMatch[1]) : 0,
|
||||||
episodeEnd : episodeRangeMatch?.[2] ? parseInt(episodeRangeMatch[2]) : 0
|
episodeEnd: episodeRangeMatch?.[2] ? parseInt(episodeRangeMatch[2]) : 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const parsedA = parseSeasonEpisode(a)
|
const parsedA = parseSeasonEpisode(a)
|
||||||
@@ -126,8 +125,6 @@ onMounted(() => {
|
|||||||
groupedDataList.value = groupMap
|
groupedDataList.value = groupMap
|
||||||
})
|
})
|
||||||
|
|
||||||
let defer = (_: number) => true
|
|
||||||
|
|
||||||
// 计算过滤后的列表
|
// 计算过滤后的列表
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
// 清空列表
|
// 清空列表
|
||||||
@@ -139,10 +136,7 @@ watchEffect(() => {
|
|||||||
groupedDataList.value?.forEach(value => {
|
groupedDataList.value?.forEach(value => {
|
||||||
if (value.length > 0) {
|
if (value.length > 0) {
|
||||||
const matchData = value.filter(data => {
|
const matchData = value.filter(data => {
|
||||||
const {
|
const { meta_info, torrent_info } = data
|
||||||
meta_info,
|
|
||||||
torrent_info,
|
|
||||||
} = data
|
|
||||||
// 季、制作组、视频编码
|
// 季、制作组、视频编码
|
||||||
return (
|
return (
|
||||||
// 站点过滤
|
// 站点过滤
|
||||||
@@ -169,7 +163,6 @@ watchEffect(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
defer = useDefer(dataList.value.length)
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -257,7 +250,7 @@ watchEffect(() => {
|
|||||||
</VCard>
|
</VCard>
|
||||||
<div class="grid gap-3 grid-torrent-card items-start">
|
<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}`">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Context } from '@/api/types'
|
import type { Context } from '@/api/types'
|
||||||
import TorrentItem from '@/components/cards/TorrentItem.vue'
|
import TorrentItem from '@/components/cards/TorrentItem.vue'
|
||||||
import { useDefer } from '@/@core/utils/dom'
|
|
||||||
|
|
||||||
// 定义输入参数
|
// 定义输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import PluginCard from '@/components/cards/PluginCard.vue'
|
|||||||
import noImage from '@images/logos/plugin.png'
|
import noImage from '@images/logos/plugin.png'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||||
import { useDefer } from '@/@core/utils/dom'
|
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { PluginTabs } from '@/router/menu'
|
import { PluginTabs } from '@/router/menu'
|
||||||
|
|
||||||
@@ -17,9 +16,6 @@ const route = useRoute()
|
|||||||
// 显示器宽度
|
// 显示器宽度
|
||||||
const display = useDisplay()
|
const display = useDisplay()
|
||||||
|
|
||||||
// 延迟加载
|
|
||||||
let deferApp = (_: number) => true
|
|
||||||
|
|
||||||
// 当前标签
|
// 当前标签
|
||||||
const activeTab = ref(route.query.tab)
|
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 (isNullOrEmptyObject(PluginStatistics.value)) return ret_list
|
||||||
// 数据排序
|
// 数据排序
|
||||||
if (!activeSort.value || activeSort.value === 'count') {
|
if (!activeSort.value || activeSort.value === 'count') {
|
||||||
@@ -418,12 +412,7 @@ onBeforeMount(async () => {
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="isAppMarketLoaded" class="grid gap-4 grid-plugin-card items-start">
|
<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}`">
|
<template v-for="(data, index) in sortedUninstalledList" :key="`${data.id}_v${data.plugin_version}`">
|
||||||
<PluginAppCard
|
<PluginAppCard :plugin="data" :count="PluginStatistics[data.id || '0']" @install="pluginInstalled" />
|
||||||
v-if="deferApp(index)"
|
|
||||||
:plugin="data"
|
|
||||||
:count="PluginStatistics[data.id || '0']"
|
|
||||||
@install="pluginInstalled"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<NoDataFound
|
<NoDataFound
|
||||||
|
|||||||
Reference in New Issue
Block a user