1.修改表格偶数行多选框背景颜色(静态)
javascript
:deep(
.el-table__body-wrapper tr:nth-child(even) td.el-table-fixed-column--left
) {
background: #1d2745;
}
2.修改表格偶数行背景颜色(静态)
javascript
:deep(
.el-table__body-wrapper tr:nth-child(even) td.el-table-fixed-column--right
) {
background: #1d2745;
}
3.动态控制背景颜色
javascript
watch(dataTheme, newValue => {
const rootStyle = document.documentElement.style;
if (newValue) {
rootStyle.setProperty("--fixed-column-left-even-bg", "#1d2745");
rootStyle.setProperty("--fixed-column-left-odd-bg", "#101836");
rootStyle.setProperty("--fixed-column-right-even-bg", "#1d2745");
} else {
rootStyle.setProperty("--fixed-column-left-even-bg", "transparent");
rootStyle.setProperty("--fixed-column-left-odd-bg", "transparent");
rootStyle.setProperty("--fixed-column-right-even-bg", "transparent");
}
});
:deep(
.el-table__body-wrapper tr:nth-child(even) td.el-table-fixed-column--left
) {
background: var(--fixed-column-left-even-bg, #1d2745);
}
:deep(
.el-table__body-wrapper tr:nth-child(odd) td.el-table-fixed-column--left
) {
background: var(--fixed-column-left-odd-bg, #101836);
}
:deep(
.el-table__body-wrapper tr:nth-child(even) td.el-table-fixed-column--right
) {
background: var(--fixed-column-right-even-bg, #1d2745);
}