mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
Fix formatter (#7098)
The replace function can only work on a string, this little tweak will make the formatter not crash the page when the value is changed.
This commit is contained in:
parent
1651682020
commit
fdb943e887
@ -24,7 +24,7 @@ ReactDOM.render(
|
||||
<div>
|
||||
<InputNumber
|
||||
defaultValue={1000}
|
||||
formatter={value => `$ ${value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`}
|
||||
formatter={value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
|
||||
parser={value => value.replace(/\$\s?|(,*)/g, '')}
|
||||
onChange={onChange}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user