mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: setter 报错不影响页面渲染
This commit is contained in:
parent
05957ce986
commit
c0a6022f75
@ -25,6 +25,7 @@ export class Field extends Component<FieldProps> {
|
||||
state = {
|
||||
collapsed: this.props.collapsed,
|
||||
display: this.props.defaultDisplay || 'inline',
|
||||
hasError: false,
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
@ -88,6 +89,10 @@ export class Field extends Component<FieldProps> {
|
||||
}
|
||||
}
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { hasError: true };
|
||||
}
|
||||
|
||||
getTipContent(propName: string, tip?: any): any {
|
||||
let tipContent = (
|
||||
<div>
|
||||
@ -114,6 +119,11 @@ export class Field extends Component<FieldProps> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { hasError } = this.state;
|
||||
if (hasError) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { className, children, meta, title, valueState, onClear, name: propName, tip } = this.props;
|
||||
const { display, collapsed } = this.state;
|
||||
const isAccordion = display === 'accordion';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user