fix: number field reported error when clear data (#2561)

This commit is contained in:
katherinehhh 2023-08-29 18:08:43 +08:00 committed by GitHub
parent 904d7ee87b
commit 9c22aebaff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ export const InputNumber: ComposedInputNumber = connect((props) => {
const { onChange, ...others } = props; const { onChange, ...others } = props;
const handleChange = (v) => { const handleChange = (v) => {
const result = parseFloat(v); const result = parseFloat(v);
onChange(Number.isNaN(result) ? '' : result); onChange(Number.isNaN(result) ? null : result);
}; };
return <AntdNumber onChange={handleChange} {...others} />; return <AntdNumber onChange={handleChange} {...others} />;
}, mapReadPretty(ReadPretty)); }, mapReadPretty(ReadPretty));