transfer的searchApi 返回值判断调整

This commit is contained in:
rickcole 2020-09-10 11:37:18 +08:00
parent 4396c4424a
commit 314ffb7ef5

View File

@ -105,12 +105,11 @@ export class BaseTransferRenderer<
return result.map(item => {
let resolved: any = null;
const value = item[valueField || 'value'];
if (Array.isArray(options)) {
resolved = find(
options,
optionValueCompare(item[valueField || 'value'], valueField)
);
// 只有 value 值有意义的时候,再去找;否则直接返回
if (Array.isArray(options) && value !== null && value !== undefined) {
resolved = find(options, optionValueCompare(value, valueField));
}
return resolved || item;