mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 03:38:41 +08:00
perf(components): [select & select-v2] optimize performance (#15962)
closed #15932
This commit is contained in:
parent
2b68f465d1
commit
5cf6f775c6
@ -669,17 +669,11 @@ const useSelect = (props: ISelectV2Props, emit) => {
|
||||
return getValueKey(item) === getValueKey(props.modelValue)
|
||||
})
|
||||
} else {
|
||||
if (props.modelValue.length > 0) {
|
||||
states.hoveringIndex = Math.min(
|
||||
...props.modelValue.map((selected) => {
|
||||
return filteredOptions.value.findIndex((item) => {
|
||||
return getValue(item) === selected
|
||||
})
|
||||
})
|
||||
states.hoveringIndex = filteredOptions.value.findIndex((item) =>
|
||||
props.modelValue.some(
|
||||
(modelValue) => getValueKey(modelValue) === getValueKey(item)
|
||||
)
|
||||
} else {
|
||||
states.hoveringIndex = -1
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,17 +453,11 @@ export const useSelect = (props: ISelectProps, emit) => {
|
||||
return getValueKey(item) === getValueKey(states.selected)
|
||||
})
|
||||
} else {
|
||||
if (states.selected.length > 0) {
|
||||
states.hoveringIndex = Math.min(
|
||||
...states.selected.map((selected) => {
|
||||
return optionsArray.value.findIndex((item) => {
|
||||
return getValueKey(item) === getValueKey(selected)
|
||||
})
|
||||
})
|
||||
states.hoveringIndex = optionsArray.value.findIndex((item) =>
|
||||
states.selected.some(
|
||||
(selected) => getValueKey(selected) === getValueKey(item)
|
||||
)
|
||||
} else {
|
||||
states.hoveringIndex = -1
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user