Skip to content

Commit

Permalink
fix(Input): update onChange function signature (#4271)
Browse files Browse the repository at this point in the history
Co-authored-by: weinianyang <[email protected]>
  • Loading branch information
weinianyang and weinianyang authored Mar 9, 2023
1 parent 8131740 commit a73e73a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/input/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| value | 当前值 | String/Number | - | |
| size | 尺寸<br/><br/>**可选值**:<br/>'small'(小)<br/>'medium'(中)<br/>'large'(大) | Enum | 'medium' | |
| defaultValue | 初始化值 | String/Number | - | |
| onChange | 发生改变的时候触发的回调<br/><br/>**签名**:<br/>Function(value: String, e: Event) => void<br/>**参数**:<br/>_value_: {String} 数据<br/>_e_: {Event} DOM事件对象 | Function | func.noop | |
| onChange | 发生改变的时候触发的回调<br/><br/>**签名**:<br/>Function(value: String, e: Event) => void<br/>**参数**:<br/>_value_: {String} 数据<br/>_e_: {Event} DOM事件对象<br>_type_: {String} 点击hasClear时有此参数值为'clear' | Function | func.noop | |
| onKeyDown | 键盘按下的时候触发的回调<br/><br/>**签名**:<br/>Function(e: Event, opts: Object) => void<br/>**参数**:<br/>_e_: {Event} DOM事件对象<br/>_opts_: {Object} 可扩展的附加信息:<br> - opts.overMaxLength: {Boolean} 已超出最大长度<br> - opts.beTrimed: {Boolean} 输入的空格被清理 | Function | func.noop | |
| disabled | 禁用状态 | Boolean | false | |
| maxLength | 最大长度 | Number | null | |
Expand Down Expand Up @@ -65,7 +65,7 @@
| value | 当前值 | String/Number | - | |
| size | 尺寸<br/><br/>**可选值**:<br/>'small'(小)<br/>'medium'(中)<br/>'large'(大) | Enum | 'medium' | |
| defaultValue | 初始化值 | String/Number | - | |
| onChange | 发生改变的时候触发的回调<br/><br/>**签名**:<br/>Function(value: String, e: Event) => void<br/>**参数**:<br/>_value_: {String} 数据<br/>_e_: {Event} DOM事件对象 | Function | func.noop | |
| onChange | 发生改变的时候触发的回调<br/><br/>**签名**:<br/>Function(value: String, e: Event) => void<br/>**参数**:<br/>_value_: {String} 数据<br/>_e_: {Event} DOM事件对象<br>_type_: {String} 点击hasClear时有此参数值为'clear' | Function | func.noop | |
| onKeyDown | 键盘按下的时候触发的回调<br/><br/>**签名**:<br/>Function(e: Event, opts: Object) => void<br/>**参数**:<br/>_e_: {Event} DOM事件对象<br/>_opts_: {Object} 可扩展的附加信息:<br> - opts.overMaxLength: {Boolean} 已超出最大长度<br> - opts.beTrimed: {Boolean} 输入的空格被清理 | Function | func.noop | |
| disabled | 禁用状态 | Boolean | false | |
| maxLength | 最大长度 | Number | null | |
Expand Down
4 changes: 2 additions & 2 deletions types/input/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface TextAreaProps extends HTMLAttributesWeak, CommonProps {
/**
* 发生改变的时候触发的回调
*/
onChange?: (value: string, e: React.ChangeEvent<HTMLTextAreaElement>) => void;
onChange?: (value: string, e: React.ChangeEvent<HTMLTextAreaElement>, type?: string) => void;

/**
* 键盘按下的时候触发的回调
Expand Down Expand Up @@ -185,7 +185,7 @@ export interface InputProps extends HTMLAttributesWeak, CommonProps {
/**
* 发生改变的时候触发的回调
*/
onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement>) => void;
onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement>, type?: string) => void;

/**
* 键盘按下的时候触发的回调
Expand Down

0 comments on commit a73e73a

Please sign in to comment.