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);
}
相关推荐
Euato_Key12 小时前
全栈视野学习Cookie——理解 Cookie 的本质
前端
前端开发呀12 小时前
我的 AI 终端配置清单
前端
心运软件13 小时前
SpringBoot+ Vue校园社团管理平台的完整架构设计
vue.js·后端
敲代码的玉米C13 小时前
测试一直在写你的真实数据根
前端·人工智能·架构
jjw_zyfx13 小时前
css vue vite实现闪烁的呼吸效果
javascript·css·vue.js
执子念的飞鱼13 小时前
File Viewer 进入 2K 节点后,我更在意这 3 条回归
前端·typescript
richdata13 小时前
动态OTB vs 静态OTB:鞋服零售该选哪种管理模式?
前端·html·零售
Jodie同志13 小时前
第16~23天:持久化、HITL、流式、MCP与安全
前端·后端·agent
Jodie同志13 小时前
第1~15天:原生Agent、RAG与LangGraph基础(完整代码实操)
前端·后端·agent
sunly_13 小时前
React useActionState 的用法详解
前端·javascript·react.js