mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Form): may scroll to incorrect field after submitted (#8159)
This commit is contained in:
parent
c6e65f4fd6
commit
8cbf153073
@ -159,10 +159,10 @@ export default createComponent({
|
||||
.then(() => {
|
||||
emit('submit', values);
|
||||
})
|
||||
.catch((errors) => {
|
||||
.catch((errors: FieldValidateError[]) => {
|
||||
emit('failed', { values, errors });
|
||||
|
||||
if (props.scrollToError) {
|
||||
if (props.scrollToError && errors[0].name) {
|
||||
scrollToField(errors[0].name);
|
||||
}
|
||||
});
|
||||
|
@ -7,7 +7,8 @@ export const inBrowser = typeof window !== 'undefined';
|
||||
// unknown type for Vue prop
|
||||
export const UnknownProp = (null as unknown) as PropType<unknown>;
|
||||
|
||||
export type ComponentInstance = ComponentPublicInstance<any>;
|
||||
// eslint-disable-next-line
|
||||
export type ComponentInstance = ComponentPublicInstance<{}, any>;
|
||||
|
||||
export function isDef<T>(val: T): val is NonNullable<T> {
|
||||
return val !== undefined && val !== null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user