fix(components): [cascader] placeholder disappeared after clear value (#9190)

This commit is contained in:
sechi 2022-08-19 00:04:32 +08:00 committed by GitHub
parent 302e928c96
commit 6ac49834ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -444,9 +444,7 @@ export default defineComponent({
updatePopperPosition()
nextTick(panel.value?.scrollToExpandingNode)
} else if (props.filterable) {
const { value } = presentText
inputValue.value = value
searchInputValue.value = value
syncPresentTextValue()
}
emit('visible-change', visible)
@ -630,9 +628,18 @@ export default defineComponent({
const handleClear = () => {
panel.value?.clearCheckedNodes()
if (!popperVisible.value && props.filterable) {
syncPresentTextValue()
}
togglePopperVisible(false)
}
const syncPresentTextValue = () => {
const { value } = presentText
inputValue.value = value
searchInputValue.value = value
}
const handleSuggestionClick = (node: CascaderNode) => {
const { checked } = node