fix:Select值不变时不应触发change

This commit is contained in:
lvxiaojiao 2023-09-22 16:12:58 +08:00
parent 921ea09052
commit 9f1beac871

View File

@ -675,7 +675,10 @@ export class Select extends React.Component<SelectProps, SelectState> {
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);
}
}