chore: remove redundant code (#16597)

* chore: remove redundant code

* remove the unused variable
This commit is contained in:
dopamine 2024-04-23 17:42:16 +08:00 committed by GitHub
parent bd1613d599
commit d83033020a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 8 deletions

View File

@ -7,7 +7,7 @@ export interface SelectV2Context {
props: ExtractPropTypes<typeof SelectProps>
expanded: boolean
tooltipRef: Ref<TooltipInstance>
onSelect: (option: Option, index: number, byClick?: boolean) => void
onSelect: (option: Option) => void
onHover: (idx: number) => void
onKeyboardNavigate: (direction: 'forward' | 'backward') => void
onKeyboardSelect: () => void

View File

@ -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])
}
}