You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB
TypeScript

declare module 'vue/types/form' {
/**
*
*/
type VFormRules<Form> = { [P in keyof Form]?: Rule[] };
/**
*
*/
interface Rule {
trigger?: 'change' | 'blur' | ['change', 'blur'];
type?:
| 'string'
| 'number'
| 'boolean'
| 'method'
| 'regexp'
| 'integer'
| 'float'
| 'array'
| 'object'
| 'enum'
| 'date'
| 'url'
| 'hex'
| 'email'
| 'any';
required?: boolean;
pattern?: RegExp;
min?: number;
max?: number;
len?: number;
whitespace?: boolean;
transform?: (val: string) => any;
message?: string;
validator?: {
rule: Rule;
value: string;
callback: (valid: boolean) => void;
};
asyncValidator?: {
rule: Rule;
value: string;
callback: (valid: boolean) => void;
};
}
interface VForm extends Vue {
/**
*
* @param rules
*/
setRules: (rules: VFormRules) => void;
/**
* w
* @param callback
*/
validate: (callback: (valid: boolean) => void) => void;
/**
*
*/
resetFields: () => void;
}
}