front/src/types/arco.d.ts

30 lines
938 B
TypeScript

declare module '@arco-design/web-vue/es/form' {
import { RuleItem } from '@arco-design/web-vue/es/form/interface';
export interface ValidatedError {
field: string;
fieldValue: any;
message: string;
}
export interface FormInstance {
validate: (fields?: string[]) => Promise<{
errors: ValidatedError[] | null;
values: Record<string, any>;
}>;
validateField: (field: string) => Promise<{
error: ValidatedError | null;
value: any;
}>;
resetFields: (fields?: string[]) => void;
clearValidate: (fields?: string[]) => void;
setFields: (data: Record<string, any>) => void;
getFields: () => Record<string, any>;
getFieldsValue: () => Record<string, any>;
getFieldValue: (field: string) => any;
setFieldValue: (field: string, value: any) => void;
setFieldsValue: (values: Record<string, any>) => void;
clearFields: (fields?: string[]) => void;
}
}