From 27e2b7e6867f536fc9a9c024fff4a1b14f13495c Mon Sep 17 00:00:00 2001 From: richardji202 <69453277+richardji202@users.noreply.github.com> Date: Mon, 28 Apr 2025 15:57:00 +0800 Subject: [PATCH 1/3] feat(select): add option removal handling for multiple selection (#3582) --- src/select/select.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/select/select.tsx b/src/select/select.tsx index f2054c51d..ae24b200d 100644 --- a/src/select/select.tsx +++ b/src/select/select.tsx @@ -215,6 +215,17 @@ export default defineComponent({ addCache(newVal); }); setValue(newVal, outputContext); + + // 触发 remove 事件 + if (props.multiple && context.trigger === 'uncheck' && optionValue) { + const evtObj = { + value: optionValue as string | number, + data: optionsMap.value.get(optionValue), + e: context.e, + }; + instance.emit('remove', evtObj); + props.onRemove?.(evtObj); + } }; const [tInputValue, setTInputValue] = useDefaultValue( From b0d0a0f852bb6793f72994e4c3ef96f0eb5fdde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Mon, 28 Apr 2025 21:15:00 +0800 Subject: [PATCH 2/3] chore: naming --- src/select/select.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/select/select.tsx b/src/select/select.tsx index ae24b200d..db6819251 100644 --- a/src/select/select.tsx +++ b/src/select/select.tsx @@ -218,13 +218,13 @@ export default defineComponent({ // 触发 remove 事件 if (props.multiple && context.trigger === 'uncheck' && optionValue) { - const evtObj = { + const context = { value: optionValue as string | number, data: optionsMap.value.get(optionValue), e: context.e, }; - instance.emit('remove', evtObj); - props.onRemove?.(evtObj); + instance.emit('remove', context); + props.onRemove?.(context); } }; From 7514dcab76fcc08f4879dc6373a068175d6a21d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Mon, 28 Apr 2025 21:17:24 +0800 Subject: [PATCH 3/3] chore: naming --- src/select/select.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/select/select.tsx b/src/select/select.tsx index db6819251..f9742ca29 100644 --- a/src/select/select.tsx +++ b/src/select/select.tsx @@ -218,13 +218,13 @@ export default defineComponent({ // 触发 remove 事件 if (props.multiple && context.trigger === 'uncheck' && optionValue) { - const context = { + const removeContext = { value: optionValue as string | number, data: optionsMap.value.get(optionValue), e: context.e, }; - instance.emit('remove', context); - props.onRemove?.(context); + instance.emit('remove', removeContext); + props.onRemove?.(removeContext); } };