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