forked from p96170835/amis
修复 TreeSelect 单选不可以清除选项的问题
This commit is contained in:
parent
c8ebbffc50
commit
721aa00e36
|
@ -173,7 +173,9 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|||
|
||||
{children}
|
||||
|
||||
{clearable && !disabled && Array.isArray(result) && result.length ? (
|
||||
{clearable &&
|
||||
!disabled &&
|
||||
(Array.isArray(result) ? result.length : result) ? (
|
||||
<a
|
||||
// data-tooltip="清空"
|
||||
// data-position="bottom"
|
||||
|
|
|
@ -327,11 +327,17 @@ export default class TreeSelectControl extends React.Component<
|
|||
extractValue,
|
||||
delimiter,
|
||||
valueField,
|
||||
onChange
|
||||
onChange,
|
||||
multiple
|
||||
} = this.props;
|
||||
|
||||
let newValue: any = Array.isArray(value) ? value.concat() : [];
|
||||
|
||||
if (!multiple && !newValue.length) {
|
||||
onChange('');
|
||||
return;
|
||||
}
|
||||
|
||||
if (joinValues || extractValue) {
|
||||
newValue = value.map(item => item[valueField || 'value']);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue