element table 改变数据列表不更新

解决办法,使用 $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)        
      }
    },

猜你喜欢

转载自blog.csdn.net/strong90/article/details/100553741