fix: set to null when text field is empty
This commit is contained in:
parent
84e4df4086
commit
285cf34c6a
@ -6,7 +6,15 @@ import { acceptEnum, mapStyledProps, mapTextComponent } from '../shared'
|
|||||||
export const Input = connect<'TextArea'>({
|
export const Input = connect<'TextArea'>({
|
||||||
getProps: mapStyledProps,
|
getProps: mapStyledProps,
|
||||||
getComponent: mapTextComponent
|
getComponent: mapTextComponent
|
||||||
})(acceptEnum(AntdInput))
|
})(acceptEnum(({onChange, ...restProps}) => (
|
||||||
|
<AntdInput
|
||||||
|
{...restProps}
|
||||||
|
onChange={(e) => {
|
||||||
|
// 文本字段,如果空要 null 处理
|
||||||
|
onChange(e.target.value ? e : null);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)))
|
||||||
|
|
||||||
Input.TextArea = connect({
|
Input.TextArea = connect({
|
||||||
getProps: mapStyledProps,
|
getProps: mapStyledProps,
|
||||||
|
Loading…
Reference in New Issue
Block a user