Ric*_*888 5 styling reactjs material-ui
我对 MaterialUI 相当陌生,我正在使用 V5。我已经看过 v4 上的代码示例,但不确定如何在 mui5 上执行相同的操作。我有一个数据网格,我想在选择时更改背景颜色+字体颜色。我该怎么做呢?
我当前的表:

更新:我的查询得到了沙箱代码演示。这应该很好 https://codesandbox.io/s/condescending-dijkstra-zc2rhs?file=/src/Demo.tsx
编辑:附加下面的代码
const myTheme = createTheme({
components: {
//@ts-ignore - this isn't in the TS because DataGird is not exported from `@mui/material`
MuiDataGrid: {
styleOverrides: {
row: {
"&.Mui-selected": {
backgroundColor: "rebeccapurple",
color: "yellow",
"&:hover": {
backgroundColor: "purple"
}
}
}
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4457 次 |
| 最近记录: |