Add prop size for cascader

This commit is contained in:
afc163 2015-12-29 18:31:48 +08:00
parent 057eae84c5
commit a4a235cd67
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import React from 'react';
import Cascader from 'rc-cascader';
import Input from '../input';
import arrayTreeFilter from 'array-tree-filter';
import classNames from 'classnames';
class AntCascader extends React.Component {
constructor(props) {
@ -25,12 +26,16 @@ class AntCascader extends React.Component {
return displayRender(label);
}
render() {
const { prefixCls, children, placeholder, style } = this.props;
const { prefixCls, children, placeholder, style, size } = this.props;
const sizeCls = classNames({
'ant-input-lg': size === 'large',
'ant-input-sm': size === 'small',
});
return (
<Cascader {...this.props} onChange={this.handleChange}>
{children ||
<Input placeholder={placeholder}
className={`${prefixCls}-input ant-input`}
className={`${prefixCls}-input ant-input ${sizeCls}`}
style={style}
value={this.getLabel()}
readOnly />}
@ -48,6 +53,7 @@ AntCascader.defaultProps = {
displayRender(label) {
return label.join(' / ');
},
size: 'default',
};
export default AntCascader;

View File

@ -31,3 +31,4 @@
| style | 自定义样式 | string | - |
| popupClassName | 自定义浮层类名 | string | - |
| placeholder | 输入框占位文本 | string | '请选择' |
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |