mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-11 10:05:07 +08:00
docs: the translation of Input-number (#2707)
This commit is contained in:
parent
f21033c316
commit
0723b9664c
18
components/input-number/demo/basic.en-US.md
Normal file
18
components/input-number/demo/basic.en-US.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
order: 0
|
||||||
|
title: basic
|
||||||
|
---
|
||||||
|
|
||||||
|
Numeric-only input box.
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { InputNumber } from 'antd';
|
||||||
|
|
||||||
|
function onChange(value) {
|
||||||
|
console.log('changed', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<InputNumber min={1} max={10} defaultValue={3} onChange={onChange} />
|
||||||
|
, mountNode);
|
||||||
|
````
|
18
components/input-number/demo/digit.en-US.md
Normal file
18
components/input-number/demo/digit.en-US.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
order: 3
|
||||||
|
title: decimals
|
||||||
|
---
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { InputNumber } from 'antd';
|
||||||
|
|
||||||
|
function onChange(value) {
|
||||||
|
console.log('changed', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<InputNumber min={1} max={10} step={0.1} onChange={onChange} />
|
||||||
|
, mountNode);
|
||||||
|
````
|
35
components/input-number/demo/disabled.en-US.md
Normal file
35
components/input-number/demo/disabled.en-US.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
order: 2
|
||||||
|
title: disabled
|
||||||
|
---
|
||||||
|
|
||||||
|
Click the button to toggle between available and disabled states.
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { InputNumber, Button } from 'antd';
|
||||||
|
|
||||||
|
const Test = React.createClass({
|
||||||
|
getInitialState() {
|
||||||
|
return {
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
toggle() {
|
||||||
|
this.setState({
|
||||||
|
disabled: !this.state.disabled,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<InputNumber min={1} max={10} disabled={this.state.disabled} defaultValue={3} />
|
||||||
|
<div style={{ marginTop: 20 }}>
|
||||||
|
<Button onClick={this.toggle} type="primary">Toggle disabled</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
ReactDOM.render(<Test />, mountNode);
|
||||||
|
````
|
29
components/input-number/demo/size.en-US.md
Normal file
29
components/input-number/demo/size.en-US.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
order: 1
|
||||||
|
title: Three sizes
|
||||||
|
---
|
||||||
|
|
||||||
|
There are three sizes available to a numeric input box. By default, the size is `28px`. The two additional sizes are `large` and `small` which means `32px` and `22px`, respectively.
|
||||||
|
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { InputNumber } from 'antd';
|
||||||
|
|
||||||
|
function onChange(value) {
|
||||||
|
console.log('changed', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<div>
|
||||||
|
<InputNumber size="large" min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||||
|
<InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||||
|
<InputNumber size="small" min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||||
|
</div>
|
||||||
|
, mountNode);
|
||||||
|
````
|
||||||
|
|
||||||
|
````css
|
||||||
|
.ant-input-number {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
````
|
27
components/input-number/index.en-US.md
Normal file
27
components/input-number/index.en-US.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
category: Components
|
||||||
|
chinese: 数字输入框
|
||||||
|
type: Form Controls
|
||||||
|
english: InputNumber
|
||||||
|
---
|
||||||
|
|
||||||
|
Enter a number within certain range with the mouse or keyboard.
|
||||||
|
|
||||||
|
## When to use
|
||||||
|
|
||||||
|
When a numeric value needs to be provided.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Property, e.g.
|
||||||
|
|
||||||
|
| member | description | type | default |
|
||||||
|
|-------------|----------------|--------------------|--------------|
|
||||||
|
| min | min value | Number | -Infinity |
|
||||||
|
| max | max vale | Number | Infinity |
|
||||||
|
| value | current value | Number | |
|
||||||
|
| step | The number to which the current value is increased or decreased. It can be an integer or decimal. | Number or String | 1 |
|
||||||
|
| defaultValue | initial value | Number | |
|
||||||
|
| onChange | The callback triggered when the value is changed. | Function | |
|
||||||
|
| disabled | disable the input | Boolean | false |
|
||||||
|
| size | width of input box | String | none |
|
Loading…
Reference in New Issue
Block a user