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);
    }

猜你喜欢

转载自www.cnblogs.com/jiaqi1719/p/13164379.html