fix className concat

This commit is contained in:
血诺 2015-11-12 21:28:02 +08:00
parent 8a62a4d009
commit 0c3432fd35

View File

@ -12,19 +12,25 @@ let AntSelect = React.createClass({
}; };
}, },
render() { render() {
let sizeClass = ''; const {size, className, combobox, notFoundContent} = this.props;
if (this.props.size === 'large') {
let sizeClass = null;
if (size === 'large') {
sizeClass = 'ant-select-lg'; sizeClass = 'ant-select-lg';
} else if (this.props.size === 'small') { } else if (size === 'small') {
sizeClass = 'ant-select-sm'; sizeClass = 'ant-select-sm';
} }
let className = this.props.className || ' ';
let notFoundContent = this.props.notFoundContent; const classNames = [];
if (this.props.combobox) {
notFoundContent = null; if (className) {
classNames.push(className);
}
if (sizeClass) {
classNames.push(sizeClass);
} }
return ( return (
<Select {...this.props} className={className + sizeClass} notFoundContent={notFoundContent} /> <Select {...this.props} className={classNames.join(' ')} notFoundContent={combobox ? null : notFoundContent} />
); );
} }
}); });