Error: please transfer a valid prop path to form item

created at 12-05-2021 views: 29


The data in the form is nested, and when the form items are dynamically added, it appears

Error: please transfer a valid prop path to form item!

The elementUI component of vue used, the data bound to the form form is:


After consulting the data, in this case, you need to use the following methods to verify the friend

Write rules directly in the el-form-item tag. At the same time, pay attention to the wording of prop. Write the traversed array name + subscript + check field

Examples are as follows:

<div v-for="(item, index) in form.friend" :key="index">
               <el-col :span="12">
                 <el-form-item label="Name"
                               :rules="{required: true, message:'Please enter your name', trigger:'blur'}"
                   <el-input v-model="" placeholder="Please enter your name" maxlength="30" />
               <el-col :span="12">
                 <el-form-item label="age"
                               :rules="{required: true, message:'Please enter age', trigger:'blur'}"
                   <el-input v-model="item.age" placeholder="Please enter age" maxlength="30" />

props and rules require data binding

created at:12-05-2021
edited at: 12-05-2021: