fix: json view 自动尝试解析字符串 (#3239)

This commit is contained in:
吴多益 2021-12-21 12:33:41 +08:00 committed by GitHub
parent 999add819f
commit a32fca4048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,11 @@ export class JSONField extends React.Component<JSONProps, object> {
let data = value;
if (source !== undefined && isPureVariable(source)) {
data = resolveVariableAndFilter(source, this.props.data, '| raw');
} else if (typeof value === 'string') {
// 尝试解析 json
try {
data = JSON.parse(value);
} catch (e) {}
}
let jsonThemeValue = jsonTheme;