feat:多行文本框支持change事件

This commit is contained in:
pianruijie 2022-06-10 18:12:07 +08:00
parent 00bcca021b
commit 1173a98d28

View File

@ -104,6 +104,13 @@ export default class TextAreaControl extends React.Component<
this.inputRef.current?.focus(); this.inputRef.current?.focus();
} }
@autobind
@bindRendererEvent<TextAreaProps, TextAreaRendererEvent>('change')
handleChange(e: React.ChangeEvent<HTMLTextAreaElement>) {
const {onChange} = this.props;
onChange && onChange(e);
}
@autobind @autobind
@bindRendererEvent<TextAreaProps, TextAreaRendererEvent>('focus') @bindRendererEvent<TextAreaProps, TextAreaRendererEvent>('focus')
handleFocus(e: React.FocusEvent<HTMLTextAreaElement>) { handleFocus(e: React.FocusEvent<HTMLTextAreaElement>) {
@ -142,7 +149,7 @@ export default class TextAreaControl extends React.Component<
const {...rest} = this.props; const {...rest} = this.props;
return ( return (
<Textarea {...rest} onFocus={this.handleFocus} onBlur={this.handleBlur} /> <Textarea {...rest} onFocus={this.handleFocus} onBlur={this.handleBlur} onChange={this.handleChange} />
); );
} }
} }