Skip to content

fix: [问题修改]密码输入框右侧图标在特定场景下不显示问题 #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/devui-vue/devui/input/src/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
&__wrap {
position: relative;
@include flex('space-between');
.devui-input-restore {
padding-right: 32px;
}
}

&__preview {
Expand Down
15 changes: 4 additions & 11 deletions packages/devui-vue/devui/input/src/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default defineComponent({
return {
error: props.error,
[props.cssClass]: true,
'devui-input-restore': showPwdIcon.value,
[sizeCls.value]: props.size !== ''
}
})
Expand All @@ -34,19 +35,11 @@ export default defineComponent({
() => props.showPassword,
(flg) => {
inputType.value = flg ? 'password' : 'text'
showPwdIcon.value = props.showPassword
},
{ 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)
Expand Down Expand Up @@ -119,9 +112,9 @@ export default defineComponent({
{showPwdIcon && (
<div class='devui-input__preview' onClick={onChangeInputType}>
{showPreviewIcon ? (
<d-icon name='preview' size='12px' key={1} />
<d-icon name='preview-forbidden' size='12px' key={1} />
) : (
<d-icon name='preview-forbidden' size='12px' key={2} />
<d-icon name='preview' size='12px' key={2} />
)}
</div>
)}
Expand Down