Vue footstep: Vue + element UI form validation has value but failed.

Time:2020-7-21
1、 As shown in the figure: there is a value but the verification fails

 

 

2
export default {
   data() {
     return {
       form: {
         template: null
       }
       rules: [
         Template: {required: true, message: 'data template cannot be empty', trigger: 'blur'}
       ]
     }
   }
 }

 

The above is the correct verification example. 3、 At present, there are two situations that will lead to validation failure. When using the custom verification method, we find that the value of value is undefined
1. The value names of prop and V-model are inconsistent

 

The name of 1 must be consistent with that of 2, and the variable at 3 must be consistent with the prop at 2

2. If no variable is declared in data {}, the validation will fail and the value obtained will be undefined.