UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

56 lines (55 loc) 927 B
/** * props */ export interface Props { gap?: number; model: Record<string, any>; rules: Rule; } /** * ItemProps */ export interface ItemProps { label: string; field: string; } /** * 校验规则项 */ export interface RuleItem { required?: boolean; message?: string; validator?: (value: any, model: Record<string, any>) => boolean | Promise<boolean>; pattern?: RegExp; } /** * 字段配置 */ export interface Fields { valid: boolean; message: string; type: string; value: Record<string, any>; } /** * 校验规则对象类型 */ export type Rule = { [key: string]: RuleItem[]; }; /** * 上下文类型 */ export type FormContext = { rules: Rule; state: { errors: Record<string, string>; requiredFields: Record<string, boolean>; }; }; /** * 组件事件类型 */ export type Emit = { (event: 'ok', value: boolean): void; };