refactor: Add lazy loading for downloading tabs

This commit is contained in:
jxxghp
2024-09-09 08:33:29 +08:00
parent 3357928e80
commit 247631fd68
2 changed files with 51 additions and 2 deletions

View File

@@ -6,6 +6,11 @@ import NoDataFound from '@/components/NoDataFound.vue'
import DownloadingCard from '@/components/cards/DownloadingCard.vue'
import store from '@/store'
// 定义输入参数
const props = defineProps<{
name: string
}>()
// 定时器
let refreshTimer: NodeJS.Timeout | null = null
@@ -18,7 +23,7 @@ const isRefreshed = ref(false)
// 获取订阅列表数据
async function fetchData() {
try {
dataList.value = await api.get('download/')
dataList.value = await api.get('download/', { params: { name: props.name } })
isRefreshed.value = true
} catch (error) {
console.error(error)