【发布时间】:2019-03-06 20:32:45
【问题描述】:
我是 React 的新手,我对如何在 Material UI 中覆盖类有点困惑。我查看了这些示例并尝试模仿它,但它似乎并没有按照我的意愿去做。
基本上,在表格行悬停时,我想让它设置与当前所做的不同的背景颜色。
这是我的方法:
const styles = theme => ({
root: {
width: "100%",
marginTop: theme.spacing.unit * 3
},
table: {
minWidth: 1020
},
tableWrapper: {
overflowX: "auto"
},
hover: {
"&:hover": {
backgroundColor: 'rgb(7, 177, 77, 0.42)'
}
}
});
return <TableRow hover classes={{hover: classes.hover}} role="checkbox" aria-checked={isSelected} tabIndex={-1} key={n.row_id} selected={isSelected}>
{this.insertRow(n, isSelected, counter, checkbox)}
;
export default withStyles(styles)(EnhancedTable);
感谢您的帮助!
【问题讨论】: