多层表单验证
1.循环校验,每一项加 :prop和:rules
2. 排除置灰项验证 :rules="!contentItem.isScoreTag?[]:formRules.isScoreTag"
3.这种方式在失去焦点时不能触发校验,采用第二种增加父容器可解决
1. <el-form-item label="scoreType:"
:prop="'contentList.'+index+'.scoreType'"
:rules="!contentItem.isScoreTag?[]:formRules.isScoreTag">
<el-input v-model="contentItem.scoreType"
:disabled="!contentItem.isScoreTag"></el-input>
</el-form-item>
可使用v-if,并多增加一层父容器
1 <el-col :span="8" 2 v-if="contentItem.tagType == 1201"> 3 <div> 4 <el-form-item label="scoreType:" 5 :prop="'content.' + index + '.scoreType'" 6 :rules="formRules.scoreType"> 7 <el-input v-model="contentItem.scoreType" 8 :disabled="false"></el-input> 9 </el-form-item> 10 </div> 11 </el-col>