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; 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 ''