mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 19:28:14 +08:00
fix(components): [select-v2] the select option style is incorrect (#15501)
* fix(components): [select-v2] the select option style is incorrect * fix: check option * chore: update
This commit is contained in:
parent
405a4aa393
commit
758d375b7e
@ -823,6 +823,27 @@ const useSelect = (props: ISelectV2Props, emit) => {
|
||||
updateOptions()
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
const { valueKey, options } = props
|
||||
const duplicateValue = new Map()
|
||||
for (const item of options) {
|
||||
const optionValue = getValue(item)
|
||||
let v = optionValue
|
||||
if (isObject(v)) {
|
||||
v = get(optionValue, valueKey)
|
||||
}
|
||||
if (duplicateValue.get(v)) {
|
||||
debugWarn(
|
||||
'ElSelectV2',
|
||||
`The option values you provided seem to be duplicated, which may cause some problems, please check.`
|
||||
)
|
||||
break
|
||||
} else {
|
||||
duplicateValue.set(v, true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
initStates()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user