HTML
<el-row v-for="(item, idx) in profession.custs" :key="-idx" class="pro-card contacts s1"> <el-row> <el-col> <el-form-item label="联系人电话" :prop="'custs.'+idx+'.custPhone'" :rules="rules.custPhone"> <el-input v-model="item.custPhone" placeholder="请输入联系人电话"></el-input> </el-form-item> </el-col> </el-row> </el-row>
DATA
profession: { // 联系人列表信息 custs:[{ custRela: '',//联系人类型 custName: '',//联系人名称 custPhone: '',//联系人电话 }], }
校验规则
//校验规则 rules:{ 'custPhone':[ {pattern: /^1(?:3d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8d|9d)d{8}$/, message: '请输入正确的格式', trigger: ['blur','change']}, ] },