mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #7174 from 2betop/fix-select-tree-mode
fix: 修复 select 的 tree 模式点击搜索结果无效果问题 Close: #7173
This commit is contained in:
commit
5037c0bfda
@ -324,8 +324,9 @@ export class Transfer<
|
||||
// 树搜索处理
|
||||
@autobind
|
||||
handleSearchTreeChange(values: Array<Option>, searchOptions: Array<Option>) {
|
||||
const {onChange, value, valueField = 'value'} = this.props;
|
||||
const {onChange, value, valueField = 'value', multiple} = this.props;
|
||||
const searchAvailableOptions = this.getFlattenArr(searchOptions);
|
||||
values = Array.isArray(values) ? values : values ? [values] : [];
|
||||
|
||||
const useArr = intersectionWith(
|
||||
searchAvailableOptions,
|
||||
@ -339,12 +340,14 @@ export class Transfer<
|
||||
);
|
||||
|
||||
const newArr: Array<Option> = [];
|
||||
if (multiple) {
|
||||
Array.isArray(value) &&
|
||||
value.forEach((item: Option) => {
|
||||
if (!unuseArr.find(v => v[valueField] === item[valueField])) {
|
||||
newArr.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
useArr.forEach(item => {
|
||||
if (!newArr.find(v => v[valueField] === item[valueField])) {
|
||||
newArr.push(item);
|
||||
|
Loading…
Reference in New Issue
Block a user