//html 部分
<el-form :model="formObj" :rules="rules"> <el-table :data="formObj.list"> <el-table-column align="center" > <template slot="header"><span>name</span></template> <template slot-scope="scope"> <el-form-item :prop="'list.'+scope.$index+'.name'" :rules="rules.name" > <el-input v-model="scope.row.name"/> </el-form-item> </template> </el-table> <el-form>
//js部分
data(){
formObj:{
list:[{name:''}]
},
rules:{
name:[{
required:true,
message:"必填",
trigger:'blur'
}]
}
}
标签:name,form,elment,校验,table,表单 From: https://www.cnblogs.com/web-jscss-dabao/p/17099023.html