前言
自己百度没有想要的,然后写了一个分享给大家,同时有好的可以给我留言,共同学习进步!
一、示例图
二、使用步骤
1.代码
<el-table-column
prop="value"
label="流水最大值"
min-width="200"
align="left"
>
<template slot-scope="scope">
<el-input
v-if="scope.row.isEdit === false"
v-model="scope.row.value"
></el-input>
<span v-else>{{ scope.row.value }}</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="140">
<template slot-scope="scope">
<el-button
v-if="scope.row.isEdit === true"
type="text"
@click="dataAdd(scope.row, false)"
>编辑</el-button
>
<el-button v-else type="text" @click="dataAdd(scope.row, true)"
>提交</el-button
>
</template>
</el-table-column>
2.读入数据
代码如下(示例):
dataTable: [],
dataAdd (row, qx) {
if (qx == true) {
let add = {
id: row.id,
value: row.value
}
this.$post(updateSerialNumber, add, (res) => {
if (res.code === 0) {
this.list()
}
})
}
return row.isEdit = qx
},