提交 c46d4718 编写于 作者: D dolymood

fix(form): should scroll into first invalid field

上级 e7a85a2d
......@@ -144,6 +144,10 @@
this.$emit(EVENT_VALID, this.validity)
this.$emit(EVENT_SUBMIT, e, this.model, this.fieldsModel)
} else {
// scrollToInvalidField
if (this.options.scrollToInvalidField && this.firstInvalidField) {
this.firstInvalidField.$el.scrollIntoView()
}
e.preventDefault()
this.$emit(EVENT_INVALID, this.validity)
}
......@@ -164,11 +168,6 @@
},
_submit(cb) {
this.validate(() => {
if (this.invalid) {
if (this.options.scrollToInvalidField && this.firstInvalidField) {
this.firstInvalidField.$el.scrollIntoView()
}
}
cb && cb(this.valid)
})
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册