fix(components): [select] getValueIndex empty error (#18867)

* fix(components): [select] getValueIndex judgment error

* feat: update
This commit is contained in:
sea 2024-11-12 15:57:27 +08:00 committed by GitHub
parent a88ace35ba
commit 84f5d6f13a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -589,7 +589,8 @@ export const useSelect = (props: ISelectProps, emit) => {
}
const getValueIndex = (arr: any[] = [], option) => {
if (!isObject(option?.value)) return arr.indexOf(option.value)
if (isUndefined(option)) return -1
if (!isObject(option.value)) return arr.indexOf(option.value)
return arr.findIndex((item) => {
return isEqual(get(item, props.valueKey), getValueKey(option))