From 042800c75011ca9c68e2eefe1bffb0232ddd4468 Mon Sep 17 00:00:00 2001 From: SimaQ Date: Sun, 25 Oct 2015 11:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20size=20=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/form/Input.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/components/form/Input.jsx b/components/form/Input.jsx index 6ca750a9ff..a00e0c4ed4 100644 --- a/components/form/Input.jsx +++ b/components/form/Input.jsx @@ -25,13 +25,12 @@ Group.defaultProps = { className: 'ant-input-group', }; + class Input extends React.Component { - // TODO getInputDOMNode() { return this.refs.input; } - // TODO getValue() { if (this.props.type === 'static') { return this.props.value; @@ -70,17 +69,16 @@ class Input extends React.Component { renderInput() { const props = this.props; const prefixCls = props.prefixCls; - const inputClassName = prefixClsFn(prefixCls, 'input'); + let inputClassName = prefixClsFn(prefixCls, 'input'); if (!props.type) { return props.children; } - // let inputClass; - // switch (props.size) { - // case 'small': inputClass = prefixClsFn(inputClassName, 'sm'); break; - // case 'large': inputClass = prefixClsFn(inputClassName, 'lg'); break; - // default: - // } + switch (props.size) { + case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break; + case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break; + default: + } switch (props.type) { case 'textarea': @@ -92,6 +90,7 @@ class Input extends React.Component {

); default: + inputClassName = props.className ? props.className : inputClassName; return ; } } @@ -107,7 +106,7 @@ Input.propTypes = { React.PropTypes.string, React.PropTypes.number, ]), - size: React.PropTypes.oneOf(['small', 'medium', 'large']), + size: React.PropTypes.oneOf(['small', 'default', 'large']), disabled: React.PropTypes.bool, value: React.PropTypes.any, defaultValue: React.PropTypes.any,