mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-12 00:00:01 +08:00
fix: 排除反序列化函数的问题,规范事件类型代码
This commit is contained in:
@@ -10,6 +10,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
import { WinKeyboard } from '@/enums/editPageEnum'
|
||||
import { RequestHttpIntervalEnum, RequestParamsObjType } from '@/enums/httpEnum'
|
||||
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||
import { excludeParseEventKeyList } from '@/enums/eventEnum'
|
||||
|
||||
/**
|
||||
* * 判断是否是开发环境
|
||||
@@ -319,6 +320,7 @@ export const JSONStringify = <T>(data: T) => {
|
||||
*/
|
||||
export const JSONParse = (data: string) => {
|
||||
return JSON.parse(data, (k, v) => {
|
||||
if (excludeParseEventKeyList.includes(k)) return v
|
||||
if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) {
|
||||
return eval(`(function(){return ${v}})()`)
|
||||
} else if (typeof v === 'string' && v.indexOf && (v.indexOf('return ') > -1)) {
|
||||
|
||||
Reference in New Issue
Block a user