From 314ffb7ef5ec6d546e65084d5a06a423deb31c0c Mon Sep 17 00:00:00 2001 From: rickcole Date: Thu, 10 Sep 2020 11:37:18 +0800 Subject: [PATCH] =?UTF-8?q?transfer=E7=9A=84searchApi=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E5=88=A4=E6=96=AD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/Transfer.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderers/Form/Transfer.tsx b/src/renderers/Form/Transfer.tsx index d864e3a3e..335575d8b 100644 --- a/src/renderers/Form/Transfer.tsx +++ b/src/renderers/Form/Transfer.tsx @@ -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;