字段组
将字段组合在一起形成列表。
用法
validate (path?: string, opts: { silent?: boolean })
Promise<T>
触发表单验证。将引发所有错误,除非opts.silent
设置为 true。
clear (path?: string)
void
清除与特定路径关联的表单错误。如果未提供路径,则清除所有表单错误。
getErrors (path?: string)
FormError[]
检索与特定路径关联的表单错误。如果未提供路径,则返回所有表单错误。
setErrors (errors: FormError[], path?: string)
void
为给定路径设置表单错误。如果未提供路径,则覆盖所有错误。
errors
Ref<FormError[]>
包含验证错误的数组的引用。使用它来访问或操作错误信息。
::field-group
::field{name="validate (path?: string, opts: { silent?: boolean })" type="Promise<T>"}
Triggers form validation. Will raise any errors unless `opts.silent` is set to true.
::
::field{name="clear (path?: string)" type="void"}
Clears form errors associated with a specific path. If no path is provided, clears all form errors.
::
::field{name="getErrors (path?: string)" type="FormError[]"}
Retrieves form errors associated with a specific path. If no path is provided, returns all form errors.
::
::field{name="setErrors (errors: FormError[], path?: string)" type="void"}
Sets form errors for a given path. If no path is provided, overrides all errors.
::
::field{name="errors" type="Ref<FormError[]>"}
A reference to the array containing validation errors. Use this to access or manipulate the error information.
::
::
配置
{
wrapper: 'mt-5 space-y-5 divide-y divide-gray-200 dark:divide-gray-800 [&>div]:pt-5 [&>div:first-child]:pt-0 [&>div:first-child]:mt-0'
}