element el-table 点击某一行 改变数据未及时刷新的问题

解决方法:

:row-class-name="tableRowClassName"
@row-click="rowClick"

 

private tableRowClassName({row, rowIndex}: any) {
        // 把每一行的索引放进row
        row.index = rowIndex;
    }
private rowClick(row: any) {
        const index = row.index;
        this.tableData.forEach((item: any) => {
            item.isSelected = false;
        });
        row.isSelected = true;
        this.$set(this.tableData, index, row);
    }

 

posted @ 2020-06-19 17:58  jiaqiq  阅读(3986)  评论(0编辑  收藏  举报