From f0b07bd854fa9a3a035fd70178a1b1da1fad89e0 Mon Sep 17 00:00:00 2001 From: bwstudio Date: Wed, 10 Jun 2026 19:46:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E7=B1=BB=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8D=95=E9=80=89=EF=BC=88=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E7=AB=AF=E6=93=8D=E4=BD=9C=E4=BC=98=E5=8C=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/App.vue | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/web/src/App.vue b/web/src/App.vue index e58615d..d2c7ef8 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -115,35 +115,40 @@ const handleRandom = async () => { } const handleSelectType = (typeId) => { - const ids = filterTypeIds.value - const idx = ids.indexOf(typeId) - if (idx >= 0) ids.splice(idx, 1) - else ids.push(typeId) + // 单选:点同一个取消,点别的切换 + if (filterTypeIds.value.length === 1 && filterTypeIds.value[0] === typeId) { + filterTypeIds.value = [] + } else { + filterTypeIds.value = [typeId] + } filterCrowdIds.value = [] - const query = ids.length ? { type_ids: ids.join(',') } : {} + const query = filterTypeIds.value.length ? { type_ids: filterTypeIds.value.join(',') } : {} router.push({ path: '/', query }) } const handleSelectCrowd = (crowdId) => { - const ids = filterCrowdIds.value - const idx = ids.indexOf(crowdId) - if (idx >= 0) ids.splice(idx, 1) - else ids.push(crowdId) + // 单选:点同一个取消,点别的切换 + if (filterCrowdIds.value.length === 1 && filterCrowdIds.value[0] === crowdId) { + filterCrowdIds.value = [] + } else { + filterCrowdIds.value = [crowdId] + } filterTypeIds.value = [] - const query = ids.length ? { crowd_ids: ids.join(',') } : {} + const query = filterCrowdIds.value.length ? { crowd_ids: filterCrowdIds.value.join(',') } : {} router.push({ path: '/', query }) // 移动端关闭菜单 menuOpen.value = false } -// 抽屉菜单选择分类 +// 抽屉菜单选择分类(单选) const handleDrawerSelectType = (typeId) => { - const ids = filterTypeIds.value - const idx = ids.indexOf(typeId) - if (idx >= 0) ids.splice(idx, 1) - else ids.push(typeId) + if (filterTypeIds.value.length === 1 && filterTypeIds.value[0] === typeId) { + filterTypeIds.value = [] + } else { + filterTypeIds.value = [typeId] + } filterCrowdIds.value = [] - const query = ids.length ? { type_ids: ids.join(',') } : {} + const query = filterTypeIds.value.length ? { type_ids: filterTypeIds.value.join(',') } : {} router.push({ path: '/', query }) // 移动端关闭菜单 menuOpen.value = false