Skip to content
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

Hotfix/input props type #2836

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export default mixins(
}
emitEvent<Parameters<TdInputProps['onChange']>>(this, 'change', val, { e, trigger: 'input' });
// 受控,重要,勿删 input无法直接实现受控
if (!this.isIE) {
if (!this.isIE && !['number', 'email'].includes(this.$props.type)) {
betavs marked this conversation as resolved.
Show resolved Hide resolved
// 修复在 popup 弹出层里输入时 光标异常的问题
const inputRef = this.$refs.inputRef as HTMLInputElement;
preCursorPos = inputRef.selectionStart;
Expand Down
2 changes: 1 addition & 1 deletion src/input/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
/** 输入框的值 */
Expand Down
2 changes: 1 addition & 1 deletion src/input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down
Loading