我正在使用Material UI组件和MaterialTable,我想使用StyledComponents来设计这些组件
但是当我尝试使用 StyledComponents 应用样式时,我没有得到想要的结果
例子:
import styled from 'styled-components'
import MaterialTable from "material-table";
export const MaterialTableStyled = styled(MaterialTable)`
/* STYLE FOR FILTER ROW */
tbody > .MuiTableRow-root:first-child {
background-color: #F1F3F4 !important;
}
`
当我使用MaterialTableStyled组件时没有应用样式。
相反,如果我div在 StyledComponent 上使用 a :
import styled from 'styled-components'
export const MaterialTableStyled = styled.div`
/* STYLE FOR FILTER ROW */
tbody > .MuiTableRow-root:first-child {
background-color: #F1F3F4 !important;
}
`
我的自定义样式以这种方式完美运行:
<MaterialTableStyled> // DIV WITH STYLES
<MaterialTable
// ALL PROPS AND STUFFS
/>
</MaterialTableStyled>
...问题是:可以“覆盖”或更改样式而不使用div来更改样式?