mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-30 02:57:50 +08:00
Merge branch 'master' of https://github.com/vueComponent/ant-design-vue
This commit is contained in:
commit
a9bcdc4c94
@ -17,6 +17,7 @@ export const FormProps = {
|
||||
hideRequiredMark: PropTypes.bool,
|
||||
model: PropTypes.object,
|
||||
rules: PropTypes.object,
|
||||
validateMessages: PropTypes.any,
|
||||
validateOnRuleChange: PropTypes.bool,
|
||||
};
|
||||
|
||||
|
@ -142,6 +142,9 @@ export default {
|
||||
}
|
||||
descriptor[this.prop] = rules;
|
||||
const validator = new AsyncValidator(descriptor);
|
||||
if (this.FormContext && this.FormContext.validateMessages) {
|
||||
validator.messages(this.FormContext.validateMessages);
|
||||
}
|
||||
const model = {};
|
||||
model[this.prop] = this.fieldValue;
|
||||
validator.validate(model, { firstFields: true }, (errors, invalidFields) => {
|
||||
|
8
types/form-model/form.d.ts
vendored
8
types/form-model/form.d.ts
vendored
@ -132,8 +132,14 @@ export declare class FormModel extends AntdComponent {
|
||||
* validation rules of form
|
||||
* @type object
|
||||
*/
|
||||
|
||||
rules: object;
|
||||
|
||||
/**
|
||||
* Default validate message. And its format is similar with newMessages's returned value
|
||||
* @type any
|
||||
*/
|
||||
validateMessages?: any;
|
||||
|
||||
/**
|
||||
* whether to trigger validation when the rules prop is changed
|
||||
* @type Boolean
|
||||
|
2
types/form/form.d.ts
vendored
2
types/form/form.d.ts
vendored
@ -389,7 +389,7 @@ export declare class Form extends AntdComponent {
|
||||
*/
|
||||
options: object;
|
||||
|
||||
createForm(context: Vue, options?: IformCreateOption): any;
|
||||
createForm(context: Vue, options?: IformCreateOption): WrappedFormUtils;
|
||||
|
||||
/**
|
||||
* Convert props to field value
|
||||
|
Loading…
Reference in New Issue
Block a user