fix(components): [select-v2] label error when value not in the options (#14656)

closed #14621
This commit is contained in:
qiang
2023-10-28 20:29:31 +08:00
committed by GitHub
parent 940b2648d3
commit bb12dd5e7e
2 changed files with 2 additions and 2 deletions

View File

@@ -478,7 +478,7 @@ describe('Select', () => {
[undefined, DEFAULT_PLACEHOLDER],
['', ''],
[[], DEFAULT_PLACEHOLDER],
[{}, '[object Object]'],
[{}, ''],
])(
'[single select] initial value is %s, placeholder is "%s"',
async (value, placeholder) => {

View File

@@ -700,7 +700,7 @@ const useSelect = (props: ISelectProps, emit) => {
states.selectedLabel = getLabel(options[selectedItemIndex])
updateHoveringIndex(selectedItemIndex)
} else {
states.selectedLabel = `${props.modelValue}`
states.selectedLabel = getValueKey(props.modelValue)
}
} else {
states.selectedLabel = ''