解决办法,使用 $set 重新给 data 赋值,原因尚不清楚(神烦啊,这什么双向绑定啊)
<el-table :data="data" stripe border>
<el-table-column label="操作" width="200px">
<template slot-scope="scope">
<el-button @click="saveClick(scope.$index, scope.row)" v-if="scope.row.isEdit" type="text" size="small">保存</el-button>
<el-button @click="editClick(scope.$index, scope.row)" v-if="!scope.row.isEdit" type="text" size="small">编辑</el-button>
</template>
</el-table-column>
</el-table>
methods: {
saveClick (index, row) {
row.isEdit = false
this.$set(this.data,index,row)
},
editClick (index, row) {
row.isEdit = true
this.$set(this.data,index,row)
}
},