【发布时间】:2019-06-01 01:12:59
【问题描述】:
Material-UI 的 ExpansionPanelSummary 组件允许通过 expandIcon 属性在其中呈现图标,并通过 expandIcon css 类更改其样式。
正如你在implementation of the component 中看到的那样,这个类有嵌套类,它添加了变换:
'&$expanded': {
transform: 'translateY(-50%) rotate(180deg)',
},
无法通过component's API 访问这个嵌套类,我需要覆盖它。
我尝试使用 jss 嵌套插件 as described here 来执行此操作,并使用 classes 属性覆盖:
expandIcon: {
"&$expanded": {
transform: "translateY(-50%) rotate(90deg)"
}
}
<ExpansionPanelSummary
expandIcon={<ExpandMoreIcon />}
classes={{
expandIcon: classes.expandIcon
}}
>
但它不起作用,我在控制台中收到了这个警告:
Warning: [JSS] Could not find the referenced rule expanded in MyExpansionPanel.
您可以查看实时代码框示例here。
我错过了什么吗?
【问题讨论】:
标签: reactjs material-ui jss