ant-design/components/input-number/demo/digit.md

28 lines
553 B
Markdown
Raw Normal View History

2016-04-15 23:56:44 +08:00
---
order: 3
2016-08-18 15:59:07 +08:00
title:
zh-CN: 小数
en-US: 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
和原生的数字输入框一样value 的精度由 step 的小数位数决定。
## en-US
A numeric-only input box whose values can be increased or decreased using a decimal step. The number of decimals (also known as precision) is determined by the step prop.
2016-04-15 23:39:39 +08:00
2017-02-13 10:55:53 +08:00
````jsx
2016-04-15 23:39:39 +08:00
import { InputNumber } from 'antd';
function onChange(value) {
console.log('changed', value);
}
ReactDOM.render(
2018-06-27 15:55:04 +08:00
<InputNumber min={0} max={10} step={0.1} onChange={onChange} />,
2018-11-28 15:00:03 +08:00
mountNode
);
2016-04-15 23:39:39 +08:00
````