diff --git a/packages/ui/form/src/use-form.ts b/packages/ui/form/src/use-form.ts index 4b6fffb6f..4844dc13a 100644 --- a/packages/ui/form/src/use-form.ts +++ b/packages/ui/form/src/use-form.ts @@ -188,7 +188,10 @@ export const useForm = >({ return fieldValidation.validate(value).catch((error) => { if (scrollToFirstError && !firstError) { firstError = true - scrollToNode(fieldName, scrollToFirstError) + scrollToNode( + fieldName, + typeof scrollToFirstError === 'object' ? scrollToFirstError : {} + ) } // 第一个出错,即退出校验 @@ -655,7 +658,7 @@ export interface UseFormProps> { /** * 提交失败自动滚动到第一个错误字段 */ - scrollToFirstError?: boolean | Options + scrollToFirstError?: boolean | ScrollOptions } export type UseFormReturn = ReturnType