mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
Merge branch 'dev' into master-fetch-dev
This commit is contained in:
commit
14b37d82d0
@ -298,6 +298,12 @@ export const JSONParse = (data: string) => {
|
|||||||
return JSON.parse(data, (k, v) => {
|
return JSON.parse(data, (k, v) => {
|
||||||
if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) {
|
if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) {
|
||||||
return eval(`(function(){return ${v}})()`)
|
return eval(`(function(){return ${v}})()`)
|
||||||
|
} else if (typeof v === 'string' && v.indexOf && (v.indexOf('return ') > -1)) {
|
||||||
|
const baseLeftIndex = v.indexOf('(')
|
||||||
|
if (baseLeftIndex > -1) {
|
||||||
|
const newFn = `function ${v.substring(baseLeftIndex)}`
|
||||||
|
return eval(`(function(){return ${newFn}})()`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user