禁用eval

This commit is contained in:
tangly1024
2024-06-15 10:51:45 +08:00
parent 19d9d896c4
commit 54978ba2f3

View File

@@ -134,16 +134,16 @@ export const convertVal = val => {
return parsedJson
}
} catch (error) {
try {
// 尝试解析对象,对象解析能力不如上一步的json
const evalObj = eval('(' + val + ')')
if (evalObj !== null) {
return evalObj
}
} catch (error) {
// Ojbject 解析失败,返回原始字符串值
return val
}
// try {
// // 尝试解析对象,对象解析能力不如上一步的json
// const evalObj = eval('(' + val + ')')
// if (evalObj !== null) {
// return evalObj
// }
// } catch (error) {
// // Ojbject 解析失败,返回原始字符串值
// return val
// }
return val
}
return val