2016-04-15 23:56:44 +08:00
---
2016-05-27 11:48:08 +08:00
order: 3
2016-08-18 15:59:07 +08:00
title:
2021-02-22 22:07:19 +08:00
zh-CN: 高精度小数
en-US: High precision decimals
2016-04-15 23:56:44 +08:00
---
2016-04-15 23:39:39 +08:00
2016-08-18 15:59:07 +08:00
## zh-CN
2021-03-31 16:07:24 +08:00
通过 `stringMode` 开启高精度小数支持,`onChange` 事件将返回 string 类型。对于旧版浏览器,你需要 BigInt polyfill。
2016-08-18 15:59:07 +08:00
## en-US
2021-02-22 22:07:19 +08:00
Use `stringMode` to support high precision decimals support. `onChange` will return string value instead. You need polyfill of BigInt if browser not support.
2016-04-15 23:39:39 +08:00
2021-02-22 22:07:19 +08:00
```tsx
2016-04-15 23:39:39 +08:00
import { InputNumber } from 'antd';
2021-02-22 22:07:19 +08:00
function onChange(value: string) {
2016-04-15 23:39:39 +08:00
console.log('changed', value);
}
2021-02-22 22:07:19 +08:00
ReactDOM.render(
< InputNumber < string >
style={{ width: 200 }}
defaultValue="1"
min="0"
max="10"
step="0.00000000000001"
onChange={onChange}
stringMode
/>,
mountNode,
);
2019-05-07 14:57:32 +08:00
```