diff --git a/packages/devui-vue/devui/input/src/input.tsx b/packages/devui-vue/devui/input/src/input.tsx index b06d36a345..36932f00a2 100644 --- a/packages/devui-vue/devui/input/src/input.tsx +++ b/packages/devui-vue/devui/input/src/input.tsx @@ -40,7 +40,9 @@ export default defineComponent({ const suffixVisible = ctx.slots.suffix || props.suffix || props.showPassword || props.clearable; const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value); - const showClearable = computed(() => props.clearable && !inputDisabled.value); + const showClearable = computed(() => { + return props.clearable && !inputDisabled.value && modelValue.value?.length > 0; + }); watch( () => props.modelValue, @@ -89,7 +91,7 @@ export default defineComponent({ onClick={clickPasswordIcon} /> )} - {showClearable.value && modelValue.value.length > 0 && ( + {showClearable.value && ( )}