Skip to content

Commit 120e04f

Browse files
richardji202uyarn
andcommitted
feat(select): add option removal handling for multiple selection (#3582) (#3584)
* feat(select): add option removal handling for multiple selection (#3582) * chore: naming * chore: naming --------- Co-authored-by: wū yāng <[email protected]>
1 parent bc04050 commit 120e04f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/select/select.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ export default defineComponent({
203203
addCache(newVal);
204204
});
205205
setValue(newVal, outputContext);
206+
207+
// 触发 remove 事件
208+
if (props.multiple && context.trigger === 'uncheck' && optionValue) {
209+
const removeContext = {
210+
value: optionValue as string | number,
211+
data: optionsMap.value.get(optionValue),
212+
e: context.e,
213+
};
214+
instance.emit('remove', removeContext);
215+
props.onRemove?.(removeContext);
216+
}
206217
};
207218

208219
const [tInputValue, setTInputValue] = useDefaultValue(

0 commit comments

Comments
 (0)