解决elementui表格高亮行覆盖自定义背景色

 <el-table :cell-class-name="tableRowClassName" :data="tableData" style="width: 100%" row-key="date">
            <el-table-column prop="name" label="姓名" width="180">
            </el-table-column>
            <el-table-column prop="address" label="地址">
            </el-table-column>
        </el-table>
   tableRowClassName({rowIndex}) {
            if (rowIndex == 1) {
                return 'warning-row';
            } else if (rowIndex == 2) {
                return 'error-row';
            }
            return '';
        },
<style scoped lang="scss">
::v-deep .el-table .warning-row {
    background: #e6a23c !important;
    color: white;
}

::v-deep .el-table .error-row {
    background: #f56c6c !important;
    color: white;
}
</style>

你可能感兴趣的:(elementui,vue.js,前端)