mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
feat: json 无数据时显示 placeholder (#1326)
This commit is contained in:
parent
36b3f6d9ac
commit
57e908f910
@ -156,6 +156,7 @@ export class JSONField extends React.Component<JSONProps, object> {
|
||||
jsonTheme,
|
||||
classnames: cx,
|
||||
hideRoot,
|
||||
placeholder,
|
||||
source
|
||||
} = this.props;
|
||||
|
||||
@ -176,13 +177,17 @@ export class JSONField extends React.Component<JSONProps, object> {
|
||||
|
||||
return (
|
||||
<div className={cx('JsonField', className)}>
|
||||
<JSONTree
|
||||
data={data}
|
||||
theme={theme}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
valueRenderer={this.valueRenderer}
|
||||
hideRoot={hideRoot}
|
||||
/>
|
||||
{typeof value === 'undefined' || value === null ? (
|
||||
placeholder
|
||||
) : (
|
||||
<JSONTree
|
||||
data={data}
|
||||
theme={theme}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
valueRenderer={this.valueRenderer}
|
||||
hideRoot={hideRoot}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user