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

28 lines
391 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 0
2016-08-18 15:59:07 +08:00
title:
2019-05-07 14:57:32 +08:00
zh-CN: 基本
en-US: Basic
2016-03-31 09:40:55 +08:00
---
2015-07-01 14:48:47 +08:00
2016-08-18 15:59:07 +08:00
## zh-CN
数字输入框。
## en-US
Numeric-only input box.
2015-07-01 14:48:47 +08:00
```tsx
import { InputNumber } from 'antd';
2022-05-23 14:37:16 +08:00
import React from 'react';
2015-07-01 14:48:47 +08:00
const onChange = (value: number) => {
2015-07-15 16:13:00 +08:00
console.log('changed', value);
};
2015-07-01 14:48:47 +08:00
const App: React.FC = () => <InputNumber min={1} max={10} defaultValue={3} onChange={onChange} />;
export default App;
2019-05-07 14:57:32 +08:00
```