直接上代码:
<template>
<el-table :data="wtpRatios" stripe border style="width: 100%">
<el-table-column prop="taskName" label="任务名称" resizable sortable></el-table-column>
<el-table-column prop="taskCode" label="任务编号" resizable sortable></el-table-column>
<el-table-column prop="numLabel" label="标注数量" resizable>
<template v-slot="scope">
<el-form-item :prop="'wtpRatios.' + scope.$index + '.id'">
<el-input v-model="rt[scope.row.id]" placeholder="标注数量"/>
</el-form-item>
</template>
</el-table-column>
</el-table>
<el-button v-model="butt" @click="tt">button</el-button>
</template>
<script>
export default {
data() {
return {
numLabel: "",
numCheck: "",
rt: {},
tblUserCols: [
{
id: 1,
name: "name1"
},
{
id: 2,
name: "name2"
},
],
wtpRatios: [
{
id: 1,
taskName: "dept01",
taskCode: "bus01",
},
{
id: 2,
taskName: "dept02",
taskCode: "bus02",
},
]
}
},
methods: {
tt(pk){
alert("dsafa");
Object.keys(this.rt).forEach((item, index) => {
alert("item:" + item)
alert(this.rt[item])
});
}
}
}
</script>