像这种表格中多个input,并想对input数据进行处理的,可以用data-属性名动态绑定数组里的类似唯一的id这种字段
<el-table :data="tableData2">
<el-table-column label="商品规格" width="135">
<template slot-scope="scope">
<el-input placeholder="填写商品规格" v-model="scope.row.specificationName"></el-input>
</template>
</el-table-column>
<el-table-column label="零售价(元)" width="135">
<template slot-scope="scope">
<el-input
placeholder="售价"
type="number"
clearable
:data-index="scope.row.barCode"
@blur="retailPriceBlur"
v-model.number="scope.row.retailPrice"
></el-input>
</template>
</el-table-column>
</el-table>
retailPriceBlur(e) {
for (var i = 0; i < this.tableData2.length; i++) {
if (this.tableData2[i].barCode == e.target.dataset.index) {
this.tableData2[i].retailPrice = Number(e.target.value).toFixed(2)
}
}
}