el-table-如何刷新表格数据

表格里面的数据更新后,可以通过以下方法来刷新表格

方法一  用更新后的数据,覆盖之前的数据

var newTableData=[];

for(var i=0;i<that.tableData.length;i++){   

    if(aId==that.selectStationId&&bId==that.selectDeviceId){

        that.tableData[i].physicalid=physicalId;

    }

    newTableData.push(that.tableData[i]);

}

that.tableData=newTableData;

方法二  使用$nextTick

<el-table :Key=“key”></el-table>

//Data里面定义

key:0

//使用

this.$nextTick(()=>{

  this.key++;

})

猜你喜欢

转载自blog.csdn.net/and_life/article/details/130488121