mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 03:08:21 +08:00
chore: remove redundant code (#16597)
* chore: remove redundant code * remove the unused variable
This commit is contained in:
parent
bd1613d599
commit
d83033020a
@ -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
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user