vue2+element ui 中的el-table 选中当前行当前行变色

 <el-table class="eltable" ref="multipleTable" :data="tableData" style="margin-top: 50px;width: 100%;"
                    :row-class-name="tableRowClassName" @row-click="rowClick">
                    <el-table-column v-for="(item, index) in tableTitleList" :label="item.name" :key="index"
                        :prop="item.prop" :width="item.width" align="center">
                    </el-table-column>
                </el-table>

方法:

   rowClick(row, column, event) {
            
            console.log(row,column);
            this.selectIndex = row.index;
        },
        // 行选中样式
        tableRowClassName({
            row,
            rowIndex
        }) {
            row.index = rowIndex 
            if (rowIndex == this.selectIndex) {
                return 'success-row';
            }
        },

样式:

::v-deep .success-row {
    background-color: #81D3F8 !important;
}

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-18 06:10:03       70 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-18 06:10:03       74 阅读
  3. 在Django里面运行非项目文件

    2024-07-18 06:10:03       62 阅读
  4. Python语言-面向对象

    2024-07-18 06:10:03       72 阅读

热门阅读

  1. Python 文件读写

    2024-07-18 06:10:03       22 阅读
  2. PHP + Swoole 与 Go 技术选型对比调研报告

    2024-07-18 06:10:03       17 阅读
  3. Spring Boot 注解 @PostConstruct 介绍

    2024-07-18 06:10:03       24 阅读
  4. 从零手写实现 nginx-31-load balance 负载均衡介绍

    2024-07-18 06:10:03       26 阅读
  5. Elasticsearch数据迁移

    2024-07-18 06:10:03       18 阅读
  6. 构建管理大师:如何在Gradle中配置源代码目录

    2024-07-18 06:10:03       21 阅读
  7. 深入解析:如何在Gradle中配置签名插件

    2024-07-18 06:10:03       23 阅读
  8. LeetCode 算法:括号生成 c++

    2024-07-18 06:10:03       22 阅读