feat: Add allowRefresh prop to DownloaderCard component

This commit is contained in:
jxxghp
2024-09-08 13:57:58 +08:00
parent 30c3ad6c90
commit ee10616acf
2 changed files with 19 additions and 4 deletions

View File

@@ -12,6 +12,11 @@ const props = defineProps({
type: Object as PropType<DownloaderConf>,
required: true,
},
// 是否允许刷新数据
allowRefresh: {
type: Boolean,
default: true,
},
})
// 定义触发的自定义事件
@@ -43,6 +48,9 @@ const downloaderInfo = ref<DownloaderConf>({
// 调用API查询下载器数据
async function loadDownloaderInfo() {
if (!props.allowRefresh) {
return
}
try {
const res: DownloaderInfo = await api.get('dashboard/downloader', {
params: {
@@ -99,7 +107,6 @@ function onClose() {
onMounted(async () => {
if (props.downloader.enabled) {
await loadDownloaderInfo()
timeoutTimer = setTimeout(loadDownloaderInfo, 3000)
}
})