我正在努力更改.MuiDataGrid-window
in MatierialUi的 css DataGrid
。因此,我遵循https://material-ui.com/api/data-grid/中的 css 规则
我在 createMuiTheme 中尝试了它,它工作正常,但不适用于窗口。我还尝试了很多不同的组合,例如 MuiDataGrid-window 或仅直接在覆盖下的“MuiDataGrid-window”,但没有任何效果..
export const theme = createMuiTheme({
overrides: {
MuiDataGrid: {
root: {
backgroundColor: 'red',
},
window: {
width: '120%',
},
},
}
});
下一个尝试是一个styled
DataGrid 组件,它也没有成功。两者都没有工作。样式化的组件将是我的首选方式!
const StyledDataGrid = styled(DataGrid)({
MuiDataGrid: {
root: {
backgroundColor: 'green',
},
window: {
width: '120%',
}
}
});
也许我完全走错了路。但是如何在 MUI 的 API 中设置 CSS 属性的样式,例如 .MuiDataGrid-mainGridContainer、.MuiDataGrid-overlay、.MuiDataGrid-columnsContainer、.MuiDataGrid-colCellWrapper 等。
非常感谢,也许它对其他人有帮助:)