方法添加表格数据
略
绑定prop(只做记录日后详解 copy就完了)
<el-form :model="form" :rules="rules" ref="ruleForm">
<el-table :data="form.tableData" border style="width: 100%">
<el-table-column prop="price" label="价格" align="center">
<template slot-scope="scope">
<el-form-item :prop="'tableData.' + scope.$index +'.price'" :rules="rules.price">
<el-input-number v-model="scope.row.price" :precision="2" :min="0.01"></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="count" label="数量" align="center">
<template slot-scope="scope">
<el-form-item :prop="'tableData.' + scope.$index + '.count'" :rules="rules.count">
<el-input-number v-model="scope.row.count" :min="0"></el-input-number>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>