mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
Add allowClear and Fix clear button in disabled mode
This commit is contained in:
parent
38a4436599
commit
6d7f571c1d
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user