From 0c81e20b57520f150a084af8bf8483503f76a693 Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 20 Mar 2024 01:00:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=B0=E5=BF=86=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/views/Sub.vue | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0c094ab5e..69df71ab5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.14.202", + "version": "2.14.203", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/views/Sub.vue b/src/views/Sub.vue index b4a83a0c1..4763b991f 100644 --- a/src/views/Sub.vue +++ b/src/views/Sub.vue @@ -260,6 +260,10 @@ const touchStartY = ref(null); const touchStartX = ref(null); const sortFailed = ref(false); const hasUntagged = ref(false); +const getTag = () => { + return localStorage.getItem('sub-tag') || 'all' + } +const tag = ref(getTag()); const tags = computed(() => { if(!hasSubs.value && !hasCollections.value) return [] // 从 subs 和 collections 中获取所有的 tag, 去重 @@ -289,9 +293,13 @@ const tags = computed(() => { const result = [{ label: t("specificWord.all"), value: "all" }, ...tags] if(hasUntagged.value) result.push({ label: t("specificWord.untagged"), value: "untagged" }) + + if (!result.find(i => i.value === tag.value)) { + tag.value = 'all' + } return result }); -const tag = ref('all'); + const filterdSubsCount = computed(() => { if(tag.value === 'all') return subs.value.length if(tag.value === 'untagged') return subs.value.filter(i => !Array.isArray(i.tag) || i.tag.length === 0).length @@ -435,6 +443,11 @@ const toggleFold = (type) => { // }; const setTag = (current) => { tag.value = current + if (current === 'all') { + localStorage.removeItem('sub-tag') + } else { + localStorage.setItem('sub-tag', current) + } }; const shouldShowElement = (element) => { if(tag.value === 'all') return true