Commit 7791ddb8 authored by 杨南鸿's avatar 杨南鸿

解决输入框第一次验证错误的问题

parent 55d3beef
......@@ -139,7 +139,8 @@
focused: false,
isComposing: false,
passwordVisible: false,
task: null
focusTimer: null,
focusOpen: false
};
},
......@@ -190,10 +191,6 @@
type: Boolean,
default: false
},
lazy: {
type: [Boolean, Object],
default: false
},
tabindex: String
},
......@@ -313,9 +310,6 @@
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.blur', [this.value]);
}
if (this.lazy) {
this.handleInput(event, true);
}
},
select() {
this.getInput().select();
......@@ -362,28 +356,22 @@
this.handleInput(event);
}
},
handleInput(event, refresh) {
handleInput(event) {
// should not emit input during composition
// see: https://github.com/ElemeFE/element/issues/10516
if (this.isComposing || (this.lazy && !refresh)) {
this.isInput = true;
let _this = this;
clearTimeout(_this.task);
_this.task = setTimeout(() => {
this.handleInput(event, true);
}, 1500);
return;
}
if (this.isComposing) return;
// hack for https://github.com/ElemeFE/element/issues/8548
// should remove the following line when we don't support IE
if (event.target.value === this.nativeInputValue) return;
this.$emit('input', event.target.value);
// ensure native input value is controlled
// see: https://github.com/ElemeFE/element/issues/12850
this.$nextTick(this.setNativeInputValue);
clearTimeout(this.focusTimer);
this.focusTimer = setTimeout(() => {
this.$emit('input', event.target.value);
// ensure native input value is controlled
// see: https://github.com/ElemeFE/element/issues/12850
this.$nextTick(this.setNativeInputValue);
}, 300);
},
handleChange(event) {
this.$emit('change', event.target.value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment