From 6376a81c4ae23861c3af980555c502f8a150c88c Mon Sep 17 00:00:00 2001 From: Aqr-K <95741669+Aqr-K@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:38:02 +0800 Subject: [PATCH] feat: Add the judgment of the switch startup for the default downloader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加默认下载器开关启动判断,保证唯一性。 --- src/components/cards/DownloaderCard.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/cards/DownloaderCard.vue b/src/components/cards/DownloaderCard.vue index 04844611..e18ee6c3 100644 --- a/src/components/cards/DownloaderCard.vue +++ b/src/components/cards/DownloaderCard.vue @@ -91,6 +91,14 @@ function openDownloaderInfoDialog() { // 保存详情数据 function saveDownloaderInfo() { + // 默认下载器去重 + if (downloaderInfo.value.default) { + props.downloaders.forEach(item => { + if (item.default && item !== props.downloader) { + item.default = false + } + }) + } // 为空不保存,跳出警告框 if (!downloaderName.value) { $toast.error('名称不能为空,请输入后再确定')