<el-card class="box-card" style="margin: 0px 20px 20px">
<div v-for="(item, index) in ruleForm.orderingContents" :key="index">
<el-form-item label="能力名称" :prop="`orderingContents.${index}.capabilityName`" :rules="rules.capabilityName">
<el-input v-model="item.capabilityName"
size="small" style="width: 60%;"></el-input>
</el-form-item>
<el-form-item label="能力编码" :prop="`orderingContents.${index}.capabilityCoding`" :rules="rules.capabilityCoding">
<el-input v-model="item.capabilityCoding"
size="small" style="width: 60%;"></el-input>
</el-form-item>
<el-form-item label="能力定价" :prop="`orderingContents.${index}.capabilityPricing`" :rules="rules.capabilityPricing">
<el-input v-model="item.capabilityPricing"
size="small" style="width: 60%;"></el-input>
</el-form-item>
<el-form-item label="能力折扣" :prop="`orderingContents.${index}.capacityDiscount`" :rules="rules.capacityDiscount">
<el-input v-model="item.capacityDiscount"
size="small" style="width: 60%;"></el-input>
</el-form-item>
</div>
<el-button class="addBtn" @click="addDomain" size="small">+ 添加能力</el-button>
</el-card>
主要是
:prop="`orderingContents.${index}.capabilityName`" :rules="rules.capabilityName"
四个input为一组是可以动态新增的,每个input都要有校验,因此prop需要是根据index动态的;