Element-ui form validation problem

Please enter the code 1. Now you want to validate a bound form data in vuex. The structure is as follows

 a: {
          b1: {
            c: ""
          },
          b2:"",
          b3:""
        },

ask everyone how to do it?

Supplementary Code

 <el-form :model="formData" :rules="formRule" label-width="100px">
      <el-form-item prop="name" label="">
        <el-input v-model="formData.name"></el-input>
      </el-form-item>
      <el-form-item prop="password" label="">
        <el-input v-model="formData.password"></el-input>
      </el-form-item>
      <el-form-item prop="user.tel" label="">
        <el-input v-model="formData.user.tel"></el-input>
      </el-form-item>
    </el-form>
    <el-button @click="handleSubmit"></el-button>
export default {
  name: "home",
  data(){
    return {
      formData:{
        name: "",
        password: "",
        user: {
          tel: ""
        }
      },
      formRule:{
        name: [{required: true, message: "", trigger: "blur"},
          {pattern: /^[\u4E00-\u9FA5]+$/, message: "", trigger: "blur"}],
        password: [{required: true, message: "", trigger: "blur"},],
        "user.tel" : [{required: true, message: "", trigger: "blur"}],
      },
    }
  },
  methods:{
    handleSubmit(){
      const t = this;
      t.$refs["formData"].validate((valid) => {
        if(valid){
          console.log(this.formData);
        }
      })
    }
  },
}
Mar.07,2021

vuex? The verification of
element-ui form form only needs to make sure that you bind: model + prop can find the corresponding value in data, and then verify your validator.
for example, if you: model= "a"
, then the prop for verifying b1: {c:'} should be prop= "b1.c"

.
Menu