Skip to content

Commit

Permalink
fix(components): [cascader] remove extra space in the search text (#1…
Browse files Browse the repository at this point in the history
…0439)

* fix(components): [cascader] remove extra space in the search text

* chore: optimize condition with computed
  • Loading branch information
holazz committed Nov 5, 2022
1 parent ad9f92b commit fe66c08
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/components/cascader/src/index.vue
Expand Up @@ -40,7 +40,7 @@
<el-input
ref="input"
v-model="inputValue"
:placeholder="searchInputValue ? '' : inputPlaceholder"
:placeholder="currentPlaceholder"
:readonly="readonly"
:disabled="isDisabled"
:validate-event="false"
Expand Down Expand Up @@ -373,6 +373,11 @@ export default defineComponent({
const inputPlaceholder = computed(
() => props.placeholder || t('el.cascader.placeholder')
)
const currentPlaceholder = computed(() =>
searchInputValue.value || presentTags.value.length > 0
? ''
: inputPlaceholder.value
)
const realSize = useSize()
const tagSize = computed(() =>
['small'].includes(realSize.value) ? 'small' : 'default'
Expand Down Expand Up @@ -401,7 +406,7 @@ export default defineComponent({
const nodes = checkedNodes.value
return nodes.length
? multiple.value
? ' '
? ''
: nodes[0].calcText(showAllLevels, separator)
: ''
})
Expand Down Expand Up @@ -738,6 +743,7 @@ export default defineComponent({
popperVisible,
inputHover,
inputPlaceholder,
currentPlaceholder,
filtering,
presentText,
checkedValue,
Expand Down

0 comments on commit fe66c08

Please sign in to comment.