fix(components): [select] fix placeholder display (#11051)

closed # 11049
This commit is contained in:
sleepyShen1989 2023-05-13 12:55:35 +08:00 committed by GitHub
parent ea82d3f7c3
commit 44376fa0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -218,6 +218,15 @@ export const useSelect = (props, states: States, ctx) => {
() => props.placeholder,
(val) => {
states.cachedPlaceHolder = states.currentPlaceholder = val
const hasValue =
props.multiple &&
Array.isArray(props.modelValue) &&
props.modelValue.length > 0
if (hasValue) {
states.currentPlaceholder = ''
}
}
)