From 7b3409d128d1596b76a79eb5b7eb20db8c35c0e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=91=B1=E8=8A=B1=E7=9A=84=E8=9B=8B?=
=?UTF-8?q?=E7=82=92=E9=A5=AD?= <2878709960@qq.com>
Date: Mon, 25 Aug 2025 18:48:27 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=AF=86=E7=A0=81?=
=?UTF-8?q?=E6=A1=86=E6=94=AF=E6=8C=81=E6=98=8E=E6=96=87=EF=BC=8C=E6=9A=97?=
=?UTF-8?q?=E6=96=87=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CHANGELOG.md | 5 +++++
src/editor/text-box/input/input.scss | 3 +++
src/editor/text-box/input/input.tsx | 33 +++++++++++++++++++++++++++-
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ceedd2e6..c9e3bcc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@
## [Unreleased]
+### Added
+
+- 更新密码框支持明文,暗文切换功能
+
+
## [0.7.41-alpha.9] - 2025-08-25
### Fixed
diff --git a/src/editor/text-box/input/input.scss b/src/editor/text-box/input/input.scss
index 63d0f13b..0558d4be 100644
--- a/src/editor/text-box/input/input.scss
+++ b/src/editor/text-box/input/input.scss
@@ -40,4 +40,7 @@
.van-field__clear{
display: getCssVar(form-item-container,required-style);
}
+ .van-field__right-icon{
+ font-size: getCssVar('form-size', 'header-4');
+ }
}
diff --git a/src/editor/text-box/input/input.tsx b/src/editor/text-box/input/input.tsx
index d39ef4fc..daac6431 100644
--- a/src/editor/text-box/input/input.tsx
+++ b/src/editor/text-box/input/input.tsx
@@ -27,12 +27,22 @@ export const IBizInput = defineComponent({
const editorModel = c.model;
const inputRef = ref();
+ // 是否显示密码
+ const showPassword = ref(false);
+
+ // 是否显示切换明文、暗文密码图标
+ let showSwitchIcon = false;
+
// 文本域默认行数,仅在 textarea 类型下有效
const rows = ref(2);
if (editorModel.editorType === 'TEXTAREA_10') {
rows.value = 10;
}
+ if (c.editorParams.showswitchicon) {
+ showSwitchIcon = c.editorParams.showswitchicon === 'true';
+ }
+
// 类型
const type = computed(() => {
switch (editorModel.editorType) {
@@ -134,6 +144,11 @@ export const IBizInput = defineComponent({
emit('change', '');
};
+ // 切换明文密码的显示隐藏
+ const switchPwd = () => {
+ showPassword.value = !showPassword.value && showSwitchIcon;
+ };
+
return {
c,
ns,
@@ -146,6 +161,8 @@ export const IBizInput = defineComponent({
onFocus,
onClear,
inputRef,
+ showPassword,
+ switchPwd,
};
},
render() {
@@ -167,13 +184,27 @@ export const IBizInput = defineComponent({
return {unitName};
};
}
+ if (this.type === 'password') {
+ slots['right-icon'] = () => {
+ return this.showPassword ? (
+
+ ) : (
+
+ );
+ };
+ }
content = (