From d7d0b2f55a32b8156d33ffd2f6c2a8f4eca2118d Mon Sep 17 00:00:00 2001 From: baisong01 Date: Thu, 10 Feb 2022 21:46:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20[=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=9B=BE=E6=A0=87=E5=9C=A8=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E4=B8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devui-vue/devui/input/src/input.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/devui-vue/devui/input/src/input.tsx b/packages/devui-vue/devui/input/src/input.tsx index 50bcfa237a..b09554977e 100644 --- a/packages/devui-vue/devui/input/src/input.tsx +++ b/packages/devui-vue/devui/input/src/input.tsx @@ -38,23 +38,16 @@ export default defineComponent({ { immediate: true } ) - watch( - () => props.modelValue, - (value) => { - value && value.length > 0 && showPreviewIcon.value - ? (showPwdIcon.value = true) - : (showPwdIcon.value = false) - } - ) - const onInput = ($event: Event) => { ctx.emit('update:modelValue', ($event.target as HTMLInputElement).value) hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input) }, onFocus = () => { + showPwdIcon.value = props.showPassword ctx.emit('focus') }, onBlur = () => { + showPwdIcon.value = !!props.modelValue ctx.emit('blur') hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur) }, From 07ad75f65b0bf7d8d94809e268973bf6ad0200bc Mon Sep 17 00:00:00 2001 From: baisong01 Date: Fri, 11 Feb 2022 10:22:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=201.=20=E6=98=8E=E6=9A=97=E6=96=87?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E5=8F=8D=E4=BA=86.=202.=20?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=81=AE=E6=8C=A1=E5=9B=BE=E6=A0=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=203.=20=E4=BA=A4=E4=BA=92=E5=92=8CAngular=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devui-vue/devui/input/src/input.scss | 3 +++ packages/devui-vue/devui/input/src/input.tsx | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/devui-vue/devui/input/src/input.scss b/packages/devui-vue/devui/input/src/input.scss index 9f8397d3df..727abf2c1c 100644 --- a/packages/devui-vue/devui/input/src/input.scss +++ b/packages/devui-vue/devui/input/src/input.scss @@ -5,6 +5,9 @@ &__wrap { position: relative; @include flex('space-between'); + .devui-input-restore { + padding-right: 32px; + } } &__preview { diff --git a/packages/devui-vue/devui/input/src/input.tsx b/packages/devui-vue/devui/input/src/input.tsx index b09554977e..bc204c44cd 100644 --- a/packages/devui-vue/devui/input/src/input.tsx +++ b/packages/devui-vue/devui/input/src/input.tsx @@ -26,6 +26,7 @@ export default defineComponent({ return { error: props.error, [props.cssClass]: true, + 'devui-input-restore': showPwdIcon.value, [sizeCls.value]: props.size !== '' } }) @@ -34,6 +35,7 @@ export default defineComponent({ () => props.showPassword, (flg) => { inputType.value = flg ? 'password' : 'text' + showPwdIcon.value = props.showPassword }, { immediate: true } ) @@ -43,11 +45,9 @@ export default defineComponent({ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input) }, onFocus = () => { - showPwdIcon.value = props.showPassword ctx.emit('focus') }, onBlur = () => { - showPwdIcon.value = !!props.modelValue ctx.emit('blur') hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur) }, @@ -112,9 +112,9 @@ export default defineComponent({ {showPwdIcon && (
{showPreviewIcon ? ( - + ) : ( - + )}
)}