mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:18:03 +08:00
修复 TreeSelect 单选不可以清除选项的问题
This commit is contained in:
parent
f7dfed9bc3
commit
4c9822c42a
@ -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
Block a user