Browse Source

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.
pull/7101/merge
tim-soft 7 years ago
committed by ddcat1115
parent
commit
fdb943e887
  1. 2
      components/input-number/demo/formatter.md

2
components/input-number/demo/formatter.md

@ -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…
Cancel
Save