以下为一层嵌套
<el-form-item v-for="(item,itemIndex) in form.button" :key="item.itemIndex" label="一级菜单" > <el-form-item :prop="'button.'+ itemIndex + '.name'" :rules="rules.inputTxt"> <el-input v-model="item.name" style="200px;"></el-input> </el-form-item> </el-form-item>
以下为两层,承接上一层的循环
<div v-for="(button,index) in item.sub_button" :key="button.index"> <el-form-item :prop="'button.'+ itemIndex +'.sub_button.'+ index + '.name'" :rules="rules.inputTxt" > <el-input v-model="button.name" style="200px;"></el-input> </el-form-item> <el-form-item :prop="'button.'+ itemIndex +'.sub_button.'+ index + '.key'" :rules="rules.inputTxt" > <el-input v-model="button.key" style="200px;"></el-input> </el-form-item> </el-form-item>