diff --git a/docs/develop/tag_usage_dev.md b/docs/develop/tag_usage_dev.md index 2f1451f674..91d69ab65f 100644 --- a/docs/develop/tag_usage_dev.md +++ b/docs/develop/tag_usage_dev.md @@ -314,6 +314,7 @@ ip 选择器,支持静态 ip 或动态 ip 的单选和多选。 - `pubKey`: 加密公钥 - `disabled`:设置是否禁用组件 - `canUseVar`: 是否可以使用全局变量,默认为true + - `textareaMode`: 手动输入密码时,表单类型为textarea,默认为false - `value`:加密后的密码值 **方法** diff --git a/en_docs/develop/tag_usage_dev.md b/en_docs/develop/tag_usage_dev.md index cc9649b9a7..2d0568e069 100644 --- a/en_docs/develop/tag_usage_dev.md +++ b/en_docs/develop/tag_usage_dev.md @@ -316,6 +316,7 @@ Password input box. - `pubKey`: crypto public key - `disabled`: set whether this component is disabled. - `canUseVar`: whether global variables can be used, which defaults to true + - `textareaMode`: When entering a password manually, the form type is textarea and the default is false - `value`: the encrypted password value **Methods** diff --git a/frontend/desktop/src/components/common/RenderForm/RenderForm.vue b/frontend/desktop/src/components/common/RenderForm/RenderForm.vue index 8404f68c22..07aff3fa97 100644 --- a/frontend/desktop/src/components/common/RenderForm/RenderForm.vue +++ b/frontend/desktop/src/components/common/RenderForm/RenderForm.vue @@ -292,11 +292,8 @@ break case 'password': val = { - type: 'object', - value: { - tag: 'value', - value: '' - } + tag: 'value', + value: '' } break default: diff --git a/frontend/desktop/src/components/common/RenderForm/tags/TagPassword.vue b/frontend/desktop/src/components/common/RenderForm/tags/TagPassword.vue index 863b55d139..4f77febd5c 100644 --- a/frontend/desktop/src/components/common/RenderForm/tags/TagPassword.vue +++ b/frontend/desktop/src/components/common/RenderForm/tags/TagPassword.vue @@ -16,15 +16,28 @@ - + @@ -51,6 +64,11 @@ required: false, default: true }, + textareaMode: { + type: Boolean, + required: false, + default: false + }, disabled: { type: Boolean, required: false, @@ -125,6 +143,12 @@ this.localVal.value = e.target.value this.inputPlaceholder = '' }, + handleTextareaInput (e) { + console.log('textarea input: ', e.target.value) + this.localVal.value = e.target.value + this.inputPlaceholder = '' + e.target.value = e.target.value.replace(/[^\n]/g, '·') + }, handleFocus () { if (this.localVal.value.length > 0) { this.inputPlaceholder = i18n.t('要修改密码请点击后重新输入密码') @@ -135,7 +159,7 @@ }, // 输入框失焦后执行加密逻辑 handleBlur () { - this.inputText = this.localVal.value + this.inputText = this.textareaMode ? this.localVal.value.replace(/[^\n]/g, '·') : this.localVal.value const encryptedVal = this.encryptPassword() this.localVal.value = encryptedVal this.change() @@ -171,7 +195,7 @@