mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
unify size api name
This commit is contained in:
parent
e3e17376f0
commit
ea3f38a58a
@ -11,9 +11,9 @@ var Datepicker = antd.Datepicker;
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Datepicker size="lg" />
|
||||
<Datepicker size={"large"} />
|
||||
<Datepicker />
|
||||
<Datepicker size="sm" />
|
||||
<Datepicker size={"small"} />
|
||||
</div>
|
||||
, document.getElementById('components-datepicker-demo-size'));
|
||||
````
|
||||
|
@ -64,6 +64,13 @@ export default React.createClass({
|
||||
showOk={this.props.showTime}
|
||||
showClear={false}/>
|
||||
);
|
||||
var sizeClass = ' ant-input-';
|
||||
if(this.props.size === 'large'){
|
||||
sizeClass += 'lg';
|
||||
}
|
||||
if(this.props.size === 'small'){
|
||||
sizeClass += 'sm';
|
||||
}
|
||||
return (
|
||||
<Datepicker
|
||||
transitionName={this.props.transitionName}
|
||||
@ -81,7 +88,7 @@ export default React.createClass({
|
||||
onChange={this.handleChange}>
|
||||
<input
|
||||
placeholder={this.props.placeholder}
|
||||
className={'ant-calendar-picker-input ant-input ant-input-' + this.props.size}/>
|
||||
className={'ant-calendar-picker-input ant-input' + sizeClass}/>
|
||||
</Datepicker>
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
| onSelect | 选择日期的回调 | function | 无 |
|
||||
| showTime | 显示时间选择条 | boolean | false |
|
||||
| disabled | 禁用 | bool | false |
|
||||
| size | 输入框大小,`lg`代表高为32px,`sm`代表高为22px,默认28px | string | 无 |
|
||||
| size | 输入框大小,`large`代表高为32px,`small`代表高为22px,默认28px | string | 无 |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-calendar-picker-input {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- order: 1
|
||||
|
||||
三种大小的数字输入框,当 className 分别为 `ant-input-number-lg` 和 `ant-input-number-sm` 时,输入框高度为 `32px` 和 `22px` ,默认高度为 `28px`
|
||||
三种大小的数字输入框,当 size 分别为 `large` 和 `small` 时,输入框高度为 `32px` 和 `22px` ,默认高度为 `28px`
|
||||
|
||||
---
|
||||
|
||||
@ -15,9 +15,9 @@ function onChange(value) {
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<InputNumber className="ant-input-number-lg" min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||
<InputNumber size={"large"} min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||
<InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||
<InputNumber className="ant-input-number-sm" min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||
<InputNumber size={"small"} min={1} max={100000} defaultValue={3} onChange={onChange} />
|
||||
</div>
|
||||
, document.getElementById('components-input-number-demo-size'));
|
||||
````
|
||||
|
@ -8,6 +8,13 @@ export default React.createClass({
|
||||
};
|
||||
},
|
||||
render() {
|
||||
return <InputNumber style={{width: 90}} {...this.props} />;
|
||||
var sizeClass = 'ant-input-number-';
|
||||
if(this.props.size === 'large'){
|
||||
sizeClass += 'lg';
|
||||
}
|
||||
if(this.props.size === 'small'){
|
||||
sizeClass += 'sm';
|
||||
}
|
||||
return <InputNumber className={sizeClass} style={{width: 90}} {...this.props} />;
|
||||
}
|
||||
});
|
||||
|
@ -25,4 +25,4 @@
|
||||
| defaultValue | 初始值 | Number | |
|
||||
| onChange | 变化回调 | Function | |
|
||||
| disabled | 禁用 | Boolean | false |
|
||||
| className | 输入框大小 | String | 无 |
|
||||
| size | 输入框大小 | String | 无 |
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- order: 0
|
||||
|
||||
三种大小的选择框,当 className 分别为 `ant-select-lg` 和 `ant-select-sm` 时,输入框高度为 `32px` 和 `22px` ,默认高度为 `28px`
|
||||
三种大小的选择框,当 size 分别为 `large` 和 `small` 时,输入框高度为 `32px` 和 `22px` ,默认高度为 `28px`
|
||||
|
||||
---
|
||||
|
||||
@ -16,7 +16,7 @@ function handleChange(value) {
|
||||
|
||||
React.render(
|
||||
<div>
|
||||
<Select className="ant-select-lg" value="lucy" style={{width:200}} onChange={handleChange}>
|
||||
<Select size={"large"} value="lucy" style={{width:200}} onChange={handleChange}>
|
||||
<Option value="jack">Jack</Option>
|
||||
<Option value="lucy">Lucy</Option>
|
||||
<Option value="disabled" disabled>Disabled</Option>
|
||||
@ -28,7 +28,7 @@ React.render(
|
||||
<Option value="disabled" disabled>Disabled</Option>
|
||||
<Option value="yiminghe">yiminghe</Option>
|
||||
</Select>
|
||||
<Select className="ant-select-sm" value="lucy" style={{width:200}} onChange={handleChange}>
|
||||
<Select size={"small"} value="lucy" style={{width:200}} onChange={handleChange}>
|
||||
<Option value="jack">Jack</Option>
|
||||
<Option value="lucy">Lucy</Option>
|
||||
<Option value="disabled" disabled>Disabled</Option>
|
||||
|
@ -11,8 +11,15 @@ var AntSelect = React.createClass({
|
||||
};
|
||||
},
|
||||
render() {
|
||||
var sizeClass = 'ant-select-';
|
||||
if(this.props.size === 'large'){
|
||||
sizeClass += 'lg';
|
||||
}
|
||||
if(this.props.size === 'small'){
|
||||
sizeClass += 'sm';
|
||||
}
|
||||
return (
|
||||
<Select {...this.props} />
|
||||
<Select className={sizeClass} {...this.props} />
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -36,7 +36,7 @@
|
||||
| placeholder | 选择框默认文字 | string | 无 |
|
||||
| searchPlaceholder | 搜索框默认文字 | string | 无 |
|
||||
| combobox | 输入框自动提示模式 | | false |
|
||||
| className | 选择框大小 | String | 无 |
|
||||
| size | 选择框大小 | String | 无 |
|
||||
|
||||
### Option props
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user