feat(Form): add scrollToField method (#5680)

This commit is contained in:
陈嘉涵
2020-02-20 16:32:14 +08:00
parent 871398b223
commit 3f14795387
4 changed files with 26 additions and 1 deletions
+9
View File
@@ -106,6 +106,15 @@ export default createComponent({
});
},
// @exposed-api
scrollToField(name) {
this.fields.forEach(item => {
if (item.name === name) {
item.$el.scrollIntoView();
}
});
},
getValues() {
return this.fields.reduce((form, field) => {
form[field.name] = field.formValue;