vue3+ElementPlus+Table+Fixed属性导致行背景颜色失效

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);
}
相关推荐
Q***K55几秒前
前端构建工具
前端
laocooon5238578866 分钟前
创建了一个带悬停效果的“我的个人主页“按钮
前端
2013编程爱好者1 小时前
Vue工程结构分析
前端·javascript·vue.js·typescript·前端框架
小满zs2 小时前
Next.js第十一章(渲染基础概念)
前端
不羁的fang少年3 小时前
前端常见问题(vue,css,html,js等)
前端·javascript·css
change_fate3 小时前
el-menu折叠后文字下移
前端·javascript·vue.js
yivifu3 小时前
CSS Grid 布局详解(2025最新标准)
前端·css
o***Z4485 小时前
前端性能优化案例
前端
张拭心5 小时前
前端没有实际的必要了?结合今年工作内容,谈谈我的看法
前端·ai编程
姜太小白5 小时前
【前端】CSS媒体查询响应式设计详解:@media (max-width: 600px) {……}
前端·css·媒体