el-form套el-table并校验

628 阅读1分钟

element-ui的el-table和el-form嵌套使用表单校验

<el-form ref="dataForm" :model="temp">
    <el-table :data="temp.dataList">
        <el-table-column prop="name" width="100" label="字段名">
          <template slot-scope="scope">
            <el-form-item 
            :prop=" 'dataList.' + scope.$index + '.name' " 
            :rules="[{required:true, message:'必须字段'}]">
              <el-input size="small" v-model="scope.row.name"></el-input>
            </el-form-item>
          </template>
        </el-table-column>
    </el-table>
</el-form>    

说一些,自己遇到的坑,form样式有label-width="100px",导致我的input框消失,而且还不报错,有和我一样的吗?