mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 01:11:26 +08:00
bec5a08368
* add input-number demo * update snapshot * update demo * docs: Update desc * update doc * clean up React useLayoutEffect warning * fix ts definition * re-trigger * update rc-uitl version * bump rc-input-number * update * update * fix ts * update demo snapshot * update doc * update demo
36 lines
730 B
Markdown
36 lines
730 B
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 高精度小数
|
|
en-US: High precision decimals
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
通过 `stringMode` 开启高精度小数支持,`onChange` 事件将返回 string 类型。对于旧版游览器,你需要 BigInt polyfill。
|
|
|
|
## en-US
|
|
|
|
Use `stringMode` to support high precision decimals support. `onChange` will return string value instead. You need polyfill of BigInt if browser not support.
|
|
|
|
```tsx
|
|
import { InputNumber } from 'antd';
|
|
|
|
function onChange(value: string) {
|
|
console.log('changed', value);
|
|
}
|
|
|
|
ReactDOM.render(
|
|
<InputNumber<string>
|
|
style={{ width: 200 }}
|
|
defaultValue="1"
|
|
min="0"
|
|
max="10"
|
|
step="0.00000000000001"
|
|
onChange={onChange}
|
|
stringMode
|
|
/>,
|
|
mountNode,
|
|
);
|
|
```
|