소스 검색

处理type不存在,避免弹窗报错

lifanagju_citu 10 달 전
부모
커밋
4fe5a73828
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/hooks/web/useDictionaries.js

+ 4 - 0
src/hooks/web/useDictionaries.js

@@ -20,6 +20,10 @@ const setDict = (type, val, cacheTime = 7200) => {
 }
 
 export const getDict = (type, params, apiType = 'dict') => {
+    if (!type) {
+      console.error('type不存在', type, params, apiType)
+      return []
+    }
     return new Promise((resolve) => {
       const item = localStorage.getItem(type)
       const catchData = item ? JSON.parse(item) : null