fix: input not support number value (#33462)

This commit is contained in:
二货机器人 2021-12-29 11:32:49 +08:00 committed by GitHub
parent c6188fd388
commit 0c621c4832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -65,7 +65,7 @@ export function fixControlledValue<T>(value: T) {
if (typeof value === 'undefined' || value === null) {
return '';
}
return value;
return String(value);
}
export function resolveOnChange<E extends HTMLInputElement | HTMLTextAreaElement>(

View File

@ -298,4 +298,9 @@ describe('Input allowClear', () => {
wrapper.unmount();
});
it('not crash when value is number', () => {
const wrapper = mount(<Input suffix="Bamboo" value={1} />);
expect(wrapper).toBeTruthy();
});
});