diff --git a/packages/components/cascader/src/index.vue b/packages/components/cascader/src/index.vue index 043e40f429..2988af0adf 100644 --- a/packages/components/cascader/src/index.vue +++ b/packages/components/cascader/src/index.vue @@ -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