Skip to content

Commit

Permalink
fix(form): 当设置了digit的stringMode为true,但是组件没有返回string (#7031)
Browse files Browse the repository at this point in the history
Co-authored-by: wondaywang <wondaywang@tencent.com>
  • Loading branch information
ldwonday and wondaywang committed May 9, 2023
1 parent 31b809e commit 5dddc32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/field/src/components/Digit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const FieldDigit: ProFieldFC<FieldDigitProps> = (
(value: number | string | null) => {
let val = value ?? undefined;

if (typeof val === 'string') {
if (!fieldProps.stringMode && typeof val === 'string') {
val = Number(val);
}
if (
Expand Down
2 changes: 1 addition & 1 deletion tests/field/field.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ describe('Field', () => {
});

await waitFor(() => {
expect(change).toBeCalledWith(1.00000000000007);
expect(change).toBeCalledWith('1.00000000000007');
});
});

Expand Down

0 comments on commit 5dddc32

Please sign in to comment.