diff --git a/examples/routers/form.vue b/examples/routers/form.vue index 0dcaaa3c..5809c816 100644 --- a/examples/routers/form.vue +++ b/examples/routers/form.vue @@ -169,6 +169,24 @@ + +
+ + + + + + + + + + + + +
+
普通组件 @@ -284,6 +302,11 @@ rate: 3, colorPicker: '' }, + formValidate5: { + name: '', + msgCheck: false, + msg: '' + }, ruleValidate: { name: [ { required: true, message: 'The name cannot be empty', trigger: 'blur' } diff --git a/src/components/form/form.vue b/src/components/form/form.vue index 7f8b8b14..6669df1e 100644 --- a/src/components/form/form.vue +++ b/src/components/form/form.vue @@ -91,6 +91,10 @@ return new Promise(resolve => { let valid = true; let count = 0; + // fields 为空需要返回promise + if (this.fields.length === 0) { + resolve(valid); + } this.fields.forEach(field => { field.validate('', errors => { if (errors) {