From 9f1beac871254cfb4511f12f5df4d32b7942e8fa Mon Sep 17 00:00:00 2001 From: lvxiaojiao Date: Fri, 22 Sep 2023 16:12:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:Select=E5=80=BC=E4=B8=8D=E5=8F=98=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=A7=A6=E5=8F=91change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-ui/src/components/Select.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/amis-ui/src/components/Select.tsx b/packages/amis-ui/src/components/Select.tsx index 90cad312b..63c705d94 100644 --- a/packages/amis-ui/src/components/Select.tsx +++ b/packages/amis-ui/src/components/Select.tsx @@ -675,7 +675,10 @@ export class Select extends React.Component { simpleValue ? selection.map(item => item[valueField]) : selection ); } else { - onChange(simpleValue ? selectItem[valueField] : selectItem); + // Downshift里面的判断修改后的值是否相等时,没有区分是否多选,且用的是!==,所以这里拦截一下 + (!selection.length || + selection[0][valueField] !== selectItem[valueField]) && + onChange(simpleValue ? selectItem[valueField] : selectItem); } }