11/* eslint-disable react/no-unused-prop-types */
2- import { Component , MouseEvent } from 'react' ;
2+ import { Component , ErrorInfo , MouseEvent } from 'react' ;
33import { isObject } from 'lodash' ;
44import classNames from 'classnames' ;
55import { Icon } from '@alifd/next' ;
@@ -9,6 +9,9 @@ import { PopupPipe, PopupContext } from '../popup';
99import './index.less' ;
1010import InlineTip from './inlinetip' ;
1111import { intl } from '../../locale' ;
12+ import { Logger } from '@alilc/lowcode-utils' ;
13+
14+ const logger = new Logger ( { level : 'warn' , bizName : 'skeleton:field' } ) ;
1215
1316export interface FieldProps {
1417 className ?: string ;
@@ -31,6 +34,10 @@ export class Field extends Component<FieldProps> {
3134 hasError : false ,
3235 } ;
3336
37+ private body : HTMLDivElement | null = null ;
38+
39+ private dispose ?: ( ) => void ;
40+
3441 constructor ( props : any ) {
3542 super ( props ) ;
3643 this . handleClear = this . handleClear . bind ( this ) ;
@@ -47,10 +54,6 @@ export class Field extends Component<FieldProps> {
4754 onExpandChange && onExpandChange ( ! collapsed ) ;
4855 } ;
4956
50- private body : HTMLDivElement | null = null ;
51-
52- private dispose ?: ( ) => void ;
53-
5457 private deployBlockTesting ( ) {
5558 if ( this . dispose ) {
5659 this . dispose ( ) ;
@@ -101,7 +104,13 @@ export class Field extends Component<FieldProps> {
101104 }
102105
103106 static getDerivedStateFromError ( ) {
104- return { hasError : true } ;
107+ return {
108+ hasError : true ,
109+ } ;
110+ }
111+
112+ componentDidCatch ( error : Error , errorInfo : ErrorInfo ) {
113+ logger . error ( `${ this . props . title } has error` , error , errorInfo ) ;
105114 }
106115
107116 getTipContent ( propName : string , tip ?: any ) : any {
@@ -194,6 +203,7 @@ export class Field extends Component<FieldProps> {
194203 */
195204function createValueState ( /* valueState?: number, onClear?: (e: React.MouseEvent) => void */ ) {
196205 return null ;
206+
197207 /*
198208 let tip: any = null;
199209 let className = 'lc-valuestate';
0 commit comments