【发布时间】:2021-02-11 10:13:30
【问题描述】:
【问题讨论】:
【问题讨论】:
你可以像这样改变组件的样式:
<Component style={{ color: 'red' }} />
https://www.w3schools.com/react/showreact.asp?filename=demo2_react_css_inline
【讨论】:
只需根据您的要求自定义样式的行和列
const StyledTableCell = withStyles((theme) => ({
head: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
},
body: {
color: "white",
fontSize: 14
}
}))(TableCell);
const StyledTableRow = withStyles((theme) => ({
root: {
"&:nth-of-type(odd)": {
backgroundColor: theme.palette.action.hover
}
}
}))(TableRow);
// Function / Class
// return
<StyledTableCell style={{ backgroundColor: "green" }} align="right"> text <StyledTableCell/>
这是我的沙盒示例 ==>>> [1]:https://codesandbox.io/s/material-demo-forked-n6rtt?file=/src/App.js
【讨论】: