diff --git a/src/components/Select.tsx b/src/components/Select.tsx index db83640e7..688cbe66f 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -109,6 +109,7 @@ export interface OptionProps { extractValue?: boolean; delimiter?: string; clearable?: boolean; + resetValue: any; placeholder?: string; disabled?: boolean; creatable?: boolean; @@ -362,6 +363,7 @@ export class Select extends React.Component { placeholder: '请选择', valueField: 'value', labelField: 'label', + resetValue: '', inline: false, disabled: false, checkAll: false, @@ -663,7 +665,7 @@ export class Select extends React.Component { const onChange = this.props.onChange; e.preventDefault(); e.stopPropagation(); - onChange(''); + onChange(this.props.resetValue); } handleAddClick() { @@ -970,6 +972,7 @@ export class Select extends React.Component { const selection = this.state.selection; const inputValue = this.state.inputValue; + const resetValue = this.props.resetValue; return ( {
{this.renderValue(options)}
- {clearable && !disabled && value && value.length ? ( + {clearable && + !disabled && + (Array.isArray(value) ? value.length : value !== resetValue) ? (