diff --git a/src/select/_example/custom-selected.tsx b/src/select/_example/custom-selected.tsx index 9f88533939..c3a338f48e 100644 --- a/src/select/_example/custom-selected.tsx +++ b/src/select/_example/custom-selected.tsx @@ -49,8 +49,19 @@ const CustomSelected = () => { { label: '选项八', value: '8' }, { label: '选项九', value: '9' }, ]} - valueDisplay={({ value }) => - Array.isArray(value) && value.length > 0 ? value.map((v, idx) => {`${v}选项`}) : null + valueDisplay={({ value, onClose }) => + Array.isArray(value) && value.length > 0 + ? value.map((v: string, idx: number) => ( + { + context.e && context.e.stopPropagation(); + onClose(idx); + }} + closable + >{`${v}选项`} + )) + : null } /> diff --git a/src/select/base/Select.tsx b/src/select/base/Select.tsx index 563a6d2459..42b37260c5 100644 --- a/src/select/base/Select.tsx +++ b/src/select/base/Select.tsx @@ -169,7 +169,7 @@ const Select = forwardRefWithStatics( } if (trigger === 'tag-remove') { - e.stopPropagation(); + e?.stopPropagation?.(); const values = getSelectValueArr(value, value[index], true, valueType, keys); // 处理onChange回调中的selectedOptions参数 const currentSelectedOptions = getSelectedOptions(values, multiple, valueType, keys, tmpPropOptions);