From 1e83e7b955372b5d1ec877ac92dd1086e816494c Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 16 May 2024 21:12:45 +0800 Subject: [PATCH] =?UTF-8?q?revert:=20=E5=9B=9E=E9=80=80=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E9=87=8D=E5=A4=8D=E8=AF=B7=E6=B1=82=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/app/useDict.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/hooks/app/useDict.ts b/src/hooks/app/useDict.ts index 9a7a815..d4ad90b 100644 --- a/src/hooks/app/useDict.ts +++ b/src/hooks/app/useDict.ts @@ -2,7 +2,6 @@ import { ref, toRefs } from 'vue' import { listCommonDict } from '@/apis' import { useDictStore } from '@/stores' -const tmpCodeZone: string[] = [] export function useDict(...codes: Array) { const res = ref({}) return (() => { @@ -13,19 +12,10 @@ export function useDict(...codes: Array) { if (dict) { res.value[code] = dict } else { - if (!tmpCodeZone.includes(code)) { - // 防止重复请求 - tmpCodeZone.push(code) - listCommonDict(code) - .then((resp) => { - res.value[code] = resp.data - dictStore.setDict(code, res.value[code]) - tmpCodeZone.splice(tmpCodeZone.indexOf(code), 1) - }) - .catch(() => { - tmpCodeZone.splice(tmpCodeZone.indexOf(code), 1) - }) - } + listCommonDict(code).then((resp) => { + res.value[code] = resp.data + dictStore.setDict(code, res.value[code]) + }) } }) return toRefs(res.value)