Skip to content

Commit bba7de6

Browse files
author
刘欢
committed
feat:对 tagRender 添加 index 入参
1 parent fd1f076 commit bba7de6

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/BaseSelect/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export type CustomTagProps = {
6868
onClose: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
6969
closable: boolean;
7070
isMaxTag: boolean;
71+
index: number | undefined;
7172
};
7273

7374
export interface BaseSelectRef {

src/Selector/MultipleSelector.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ const SelectSelector: React.FC<SelectorProps> = (props) => {
136136
onPreventMouseDown(e);
137137
onToggleOpen(!open);
138138
};
139+
const index = values.findIndex((item) => item.value === value);
139140
return (
140141
<span onMouseDown={onMouseDown}>
141142
{tagRender({
142143
label: content,
143144
value,
145+
index: index >= 0 ? index : undefined,
144146
disabled: itemDisabled,
145147
closable,
146148
onClose,

0 commit comments

Comments
 (0)