提交 6d7f571c 编写于 作者: A afc163

Add allowClear and Fix clear button in disabled mode

上级 38a44365
......@@ -51,12 +51,12 @@ class AntCascader extends React.Component {
this.setState({ popupVisible: false });
}
render() {
const { prefixCls, children, placeholder, size, disabled, className } = this.props;
const { prefixCls, children, placeholder, size, disabled, className, allowClear } = this.props;
const sizeCls = classNames({
'ant-input-lg': size === 'large',
'ant-input-sm': size === 'small',
});
const clearIcon = this.state.value.length > 0 ?
const clearIcon = (allowClear && !disabled && this.state.value.length > 0) ?
<Icon type="cross-circle"
className={`${prefixCls}-picker-clear`}
onClick={this.clearSelection} /> : null;
......@@ -105,6 +105,7 @@ AntCascader.defaultProps = {
return label.join(' / ');
},
disabled: false,
allowClear: true,
onPopupVisibleChange() {},
};
......
......@@ -35,3 +35,4 @@
| placeholder | 输入框占位文本 | string | '请选择' |
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
| disabled | 禁用 | boolean | false |
| allowClear | 是否支持清除 | boolean | true |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册