diff --git a/packages/components/select-v2/src/token.ts b/packages/components/select-v2/src/token.ts index 6279355556..da3073811f 100644 --- a/packages/components/select-v2/src/token.ts +++ b/packages/components/select-v2/src/token.ts @@ -7,7 +7,7 @@ export interface SelectV2Context { props: ExtractPropTypes expanded: boolean tooltipRef: Ref - onSelect: (option: Option, index: number, byClick?: boolean) => void + onSelect: (option: Option) => void onHover: (idx: number) => void onKeyboardNavigate: (direction: 'forward' | 'backward') => void onKeyboardSelect: () => void diff --git a/packages/components/select-v2/src/useSelect.ts b/packages/components/select-v2/src/useSelect.ts index 6fcec61a81..43aa1dd0ce 100644 --- a/packages/components/select-v2/src/useSelect.ts +++ b/packages/components/select-v2/src/useSelect.ts @@ -78,7 +78,6 @@ const useSelect = (props: ISelectV2Props, emit) => { }) // data refs - const selectedIndex = ref(-1) const popperSize = ref(-1) // DOM & Component refs @@ -490,7 +489,7 @@ const useSelect = (props: ISelectV2Props, emit) => { tagTooltipRef.value?.updatePopper?.() } - const onSelect = (option: Option, idx: number) => { + const onSelect = (option: Option) => { if (props.multiple) { let selectedOptions = (props.modelValue as any[]).slice() @@ -518,7 +517,6 @@ const useSelect = (props: ISelectV2Props, emit) => { states.inputValue = '' } } else { - selectedIndex.value = idx states.selectedLabel = getLabel(option) update(getValue(option)) expanded.value = false @@ -661,10 +659,7 @@ const useSelect = (props: ISelectV2Props, emit) => { ~states.hoveringIndex && filteredOptions.value[states.hoveringIndex] ) { - onSelect( - filteredOptions.value[states.hoveringIndex], - states.hoveringIndex - ) + onSelect(filteredOptions.value[states.hoveringIndex]) } }