ELEMENT-UI 封装el-table 局部刷新row

 

//关于封装的el-table行数据更新后如何局部更新row
row.status=status;
this.$set(this.$refs.elTable.$data.tableData,index,row);
//这样就无需刷新整个elTable
 
 //以下是el-table写法
amendList(index,row){
                this.amend=true;

                this.tableRow=row;
                this.tableIndex=index
                var result={};
                for (var key in this.tableRow) {
                  result[key] = typeof this.tableRow[key]==='object'? this.tableRow[key]: this.tableRow[key];
                }
                this.amendForm=result;
                this.tableRow=result;

                console.log(this.tableRow);
                return result;
              },
              amendAdd(){
                this.$set(this.tableData,this.tableIndex,this.amendForm);
                this.amend=false;
                this.$message({
                  type: 'success',
                  message: '修改成功!'
                });
              },

 

posted @ 2019-07-09 14:55  何博  阅读(17116)  评论(0编辑  收藏  举报