From 0a123579979e5a6b8f13d453c1b6339d10d7ac34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Thu, 29 Aug 2024 22:13:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=AA=E5=A4=84=E7=90=86=20'formatte?= =?UTF-8?q?r'=20key=20=E4=B8=BA=E5=87=BD=E6=95=B0=E7=BB=93=E6=9E=84?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=94=99=E8=AF=AF=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/utils.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 70cf7be9..48bef70c 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -324,13 +324,17 @@ export const evalFn = (fn: string) => { * @param data */ export const JSONParse = (data: string) => { + if (data.trim() === '') return return JSON.parse(data, (k, v) => { - // 过滤函数字符串 - if (excludeParseEventKeyList.includes(k)) return v - // 过滤函数值表达式 - if (typeof v === 'string') { - const someValue = excludeParseEventValueList.some(excludeValue => v.indexOf(excludeValue) > -1) - if (someValue) return v + // // 过滤函数字符串 + // if (excludeParseEventKeyList.includes(k)) return v + // // 过滤函数值表达式 + // if (typeof v === 'string') { + // const someValue = excludeParseEventValueList.some(excludeValue => v.indexOf(excludeValue) > -1) + // if (someValue) return v + // } + if (k !== 'formatter') { + return v } // 还原函数值 if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) {