我正在尝试更改选项卡的背景颜色。我尝试使用下面的classes
道具来覆盖这些类,但没有任何效果!我错过了什么或者这是不可能的事情吗?
classes={{
rootInherit: {
backgroudColor: '#0000ff'
},
rootPrimary: {
backgroudColor: '#0000ff'
},
rootPrimarySelected: {
backgroudColor: '#0000ff'
},
rootPrimaryDisabled: {
backgroudColor: '#0000ff'
},
rootSecondary: {
backgroudColor: '#0000ff'
},
rootSecondarySelected: {
backgroudColor: '#0000ff'
},
rootSecondaryDisabled: {
backgroudColor: '#0000ff'
},
rootInheritSelected: {
backgroudColor: '#0000ff'
},
rootInheritDisabled: {
backgroudColor: '#0000ff'
}
}}
答案 0 :(得分:0)
Tab
的颜色,您需要设置backgroundColor
并覆盖每个rootSecondarySelected
,rootPrimarySelected
,rootInheritSelected
类个人Tab
组件:
const styles = theme => ({
colorfulTabs: {
backgroundColor: "#00ff00",
},
});
<Tabs>
<Tab
classes={{
rootInheritSelected: classes.colorfulTabs,
rootPrimarySelected: classes.colorfulTabs,
rootSecondarySelected: classes.colorfulTabs
}}
label="Item One"
/>
<Tab
classes={{
rootInheritSelected: classes.colorfulTabs,
rootPrimarySelected: classes.colorfulTabs,
rootSecondarySelected: classes.colorfulTabs
}}
label="Item Two" />
<Tab
classes={{
rootInheritSelected: classes.colorfulTabs,
rootPrimarySelected: classes.colorfulTabs,
rootSecondarySelected: classes.colorfulTabs
}}
label="Item Three" />
</Tabs>
rootInheritSelected
类将应用于Tabs
,其中未设置textColor
道具(即文本颜色从父项继承)。 rootPrimarySelected
课程适用于Tabs
textColor
为primary
,rootSecondarySelected
为secondary
。