mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Form): scroll to first matched field (#7102)
This commit is contained in:
parent
938e274251
commit
7c3549ad55
@ -124,10 +124,12 @@ export default createComponent({
|
||||
|
||||
// @exposed-api
|
||||
scrollToField(name, options) {
|
||||
this.fields.forEach((item) => {
|
||||
this.fields.some((item) => {
|
||||
if (item.name === name) {
|
||||
item.$el.scrollIntoView(options);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
@ -167,6 +169,7 @@ export default createComponent({
|
||||
});
|
||||
|
||||
if (this.scrollToError) {
|
||||
console.log('scrollToField', errors[0].name);
|
||||
this.scrollToField(errors[0].name);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user