From 82e81f21a6c21dff9eff32a898ce0fc35b9ca7a8 Mon Sep 17 00:00:00 2001 From: betavs <392368711@qq.com> Date: Sat, 7 Oct 2023 17:24:00 +0800 Subject: [PATCH 1/2] fix(input): enable props type email --- src/input/props.ts | 2 +- src/input/type.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input/props.ts b/src/input/props.ts index aecb4c45f..204d9a396 100644 --- a/src/input/props.ts +++ b/src/input/props.ts @@ -108,7 +108,7 @@ export default { default: 'text' as TdInputProps['type'], validator(val: TdInputProps['type']): boolean { if (!val) return true; - return ['text', 'number', 'url', 'tel', 'password', 'search', 'submit', 'hidden'].includes(val); + return ['text', 'number', 'url', 'tel', 'email', 'password', 'search', 'submit', 'hidden'].includes(val); }, }, /** 输入框的值 */ diff --git a/src/input/type.ts b/src/input/type.ts index ab776b0c9..36d48e1ac 100644 --- a/src/input/type.ts +++ b/src/input/type.ts @@ -113,7 +113,7 @@ export interface TdInputProps { * 输入框类型 * @default text */ - type?: 'text' | 'number' | 'url' | 'tel' | 'password' | 'search' | 'submit' | 'hidden'; + type?: 'text' | 'number' | 'url' | 'tel' | 'email' | 'password' | 'search' | 'submit' | 'hidden'; /** * 输入框的值 * @default '' From 0f24da2ec5a66cba5f6d75e793efaf0a255541e4 Mon Sep 17 00:00:00 2001 From: betavs <392368711@qq.com> Date: Sat, 7 Oct 2023 17:45:11 +0800 Subject: [PATCH 2/2] fix(input): props type number and email does not support selection --- src/input/input.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/input.tsx b/src/input/input.tsx index 2b53f20d7..9512552e0 100644 --- a/src/input/input.tsx +++ b/src/input/input.tsx @@ -385,7 +385,7 @@ export default mixins( } emitEvent>(this, 'change', val, { e, trigger: 'input' }); // 受控,重要,勿删 input无法直接实现受控 - if (!this.isIE) { + if (!this.isIE && !['number', 'email'].includes(this.$props.type)) { // 修复在 popup 弹出层里输入时 光标异常的问题 const inputRef = this.$refs.inputRef as HTMLInputElement; preCursorPos = inputRef.selectionStart;