我对MaterialUI相当陌生,我正在使用V5。我在v4上看到了这方面的代码示例,但不确定如何在mui5上做同样的工作。我有一个数据网格,我想改变背景颜色+字体颜色时,选择。我该怎么做?
我现在的桌子:

发布于 2022-03-27 18:33:18
更新:我的查询有一个沙箱代码演示。这应该是很好的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"
}
}
}
}
}
}
});发布于 2022-06-17 17:39:50
@Rick45888,现在您可以使用以下支持pro组件中的打字本-
import type {} from "@mui/x-data-grid-pro/themeAugmentation";https://stackoverflow.com/questions/71635257
复制相似问题