Parcourir la source

非空报错异常处理

tangning il y a 1 jour
Parent
commit
28b8796b7d
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/util/index.ts

+ 2 - 1
src/util/index.ts

@@ -329,7 +329,8 @@ export const mixEnum = <T, K>(enum1: T, enum2: K): T | K => {
 
 // 字符串转params对象
 export const strToParams = (str: string) => {
-  if (str[0] === "?") {
+  if (!str) return {};
+  if (str?.[0] === "?") {
     str = str.substr(1);
   }