<html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx</center> </body> </html>

in element-ui, if the form binds an object, the object contains multiple objects, for example:

formData: { 
    "applymember": {
        "name": "12", 
        "professionalname": "", 
        "gender": "", "birth": "", 
        "email": "", 
        "phone": "" 
     }
     ...
 }

bind this object in el-form :

<el-form label-position="left" label-width="80px" :model="formData">
        <personal-info class="card-style"
                       :form-data.sync="formData"/>
        ...
</el-form>

then bind the properties of this object in prop in element-form-item , for example:

<el-form-item label=""
                  :prop="formData.applymember.email"
                  :rules="[
                    { required: true, message: "" },
                    { type: "email", message: "" }
                  ]"
                  v-if="formData.applymember && formData.applymember.email !== undefined">
  <el-input v-model="formData.applymember.email"
            prefix-icon="el-icon-message"/>
</el-form-item>

the rule in rules is invalid , and any input in this input will pass.

I learned by consulting the data that if the rules rule is to take effect, you must bind the corresponding property in prop , which is the property of the object bound by the form. If prop needs to bind the property is the property of the object in the object, rules seems to be invalid.
so how should prop be written, or some other way to make the rules in rules take effect without modifying the form binding object
?

Mar.28,2021

I took a look at the photo taken by the second-class object. I have also encountered consulting the source code before and learned that
`< el-form-item label= "monthly rent:" prop= "housingInfoBean.rentalPrice" >

    <el-input v-model.trim="form.housingInfoBean.rentalPrice"></el-input>/

< / el-form-item > `when binding, data is declared to be a secondary object
rules binding is like this "housingInfoBean.rentalPrice": [{required: true, message: 'Please enter a name', trigger: 'blur'},], this place must be a string to be valid


Why should they be mixed together? it is recommended to use vuex to store state, parent and child components to complete their respective business logic. It's clearer this way.

Menu