Skip to content

Commit 7fe519f

Browse files
richardji202uyarn
andauthored
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 f537033 commit 7fe519f

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
@@ -215,6 +215,17 @@ export default defineComponent({
215215
addCache(newVal);
216216
});
217217
setValue(newVal, outputContext);
218+
219+
// 触发 remove 事件
220+
if (props.multiple && context.trigger === 'uncheck' && optionValue) {
221+
const removeContext = {
222+
value: optionValue as string | number,
223+
data: optionsMap.value.get(optionValue),
224+
e: context.e,
225+
};
226+
instance.emit('remove', removeContext);
227+
props.onRemove?.(removeContext);
228+
}
218229
};
219230

220231
const [tInputValue, setTInputValue] = useDefaultValue(

0 commit comments

Comments
 (0)