mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:18:34 +08:00
fix:修复input-email配置clearable,清空内容报错问题 (#3886)
Co-authored-by: Qin,Haoyan <qinhaoyan@baidu.com>
This commit is contained in:
parent
bf5c51712a
commit
3bea44c9e4
@ -235,7 +235,16 @@ export default class TextControl extends React.PureComponent<
|
||||
|
||||
// 光标放到最后
|
||||
const len = this.input.value.length;
|
||||
len && this.input.setSelectionRange(len, len);
|
||||
if (len) {
|
||||
// type为email的input元素不支持setSelectionRange,先改为text
|
||||
if (this.input.type === 'email') {
|
||||
this.input.type = 'text';
|
||||
this.input.setSelectionRange(len, len);
|
||||
this.input.type = 'email';
|
||||
} else {
|
||||
this.input.setSelectionRange(len, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearValue() {
|
||||
|
Loading…
Reference in New Issue
Block a user