表格里面的数据更新后,可以通过以下方法来刷新表格
方法一 用更新后的数据,覆盖之前的数据
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++;
})
当表格中的数据更新后,可以采用两种方法来刷新显示。一种是用新的数据覆盖原有数据,遍历并修改相应项;另一种是利用Vue的$nextTick方法更新表格的key值,触发视图重绘。

929

被折叠的 条评论
为什么被折叠?



