diff --git a/.vscode/settings.json b/.vscode/settings.json index 6164b32ccd..beeb08a71e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, + "source.fixAll.eslint": "explicit" }, "cSpell.words": ["activable", "actived", "borderless", "Cascader", "Popconfirm", "Swiper", "tdesign"] } diff --git a/src/select/_example/multiple.jsx b/src/select/_example/multiple.jsx index 8f223b9ca0..02c5e7f322 100644 --- a/src/select/_example/multiple.jsx +++ b/src/select/_example/multiple.jsx @@ -35,8 +35,24 @@ const MultipleSelect = () => { return ( - + { + console.log('onRemove', options); + }} + > {options2.map((item) => ( ))} diff --git a/src/select/base/Select.tsx b/src/select/base/Select.tsx index 4d238e5a10..2dad56f6bf 100644 --- a/src/select/base/Select.tsx +++ b/src/select/base/Select.tsx @@ -350,6 +350,12 @@ const Select = forwardRefWithStatics( const selectedOptions = getSelectedOptions(values, multiple, valueType, keys, tmpPropOptions); onChange(values, { e, selectedOptions, trigger: 'uncheck' }); tagProps?.onClose?.({ e }); + + onRemove?.({ + value: value[key], + data: { label: v, value: value[key] }, + e, + }); }} > {v} diff --git a/src/select/type.ts b/src/select/type.ts index 1f32030582..777027a271 100644 --- a/src/select/type.ts +++ b/src/select/type.ts @@ -317,7 +317,7 @@ export type SelectValueChangeTrigger = 'clear' | 'tag-remove' | 'backspace' | 'c export interface SelectRemoveContext { value: string | number; data: T; - e: MouseEvent | KeyboardEvent; + e: MouseEvent | KeyboardEvent; } export type SelectOption = TdOptionProps | SelectOptionGroup | PlainObject;