<el-form :model="FormData" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-table
:data="FormData.tableData"
:row-class-name="tableRowClassName"
style="width: 100%">
<el-table-column
prop="date"
label="日期"
width="180">
</el-table-column>
<el-table-column
label="姓名"
width="480">
<template slot-scope="scope">
<el-form-item :prop=`tableData[${scope.$index}].name`
:rules="FormData.rules.name"
label-width="0px"
>
<el-input v-model="scope.row.name"></el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
</el-table>
{{tableData}}
</el-form>
<el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
FormData: {
tableData: [{
date: '2016-05-02',
name: '王小虎0',
address: '上海市普陀区金沙江路 1518 弄'
},
{
date: '2016-05-03',
name: '王小虎1',
address: '上海市普陀区金沙江路 1516 弄'
},
{
date: '2016-05-03',
name: '王小2',
address: '上海市普陀区金沙江路 1516 弄'
}],
rules: {
name: [
{ required: true, message: '输入名称', trigger: 'blur' }
]
}
},
如果el-form-item 单独验证 可以绑定:rules 进项校验