2
我正在使用材料UI中的小吃店元素。此時小吃店出現黑色。你知道我可以如何改變顏色嗎?背景顏色只會改變小吃店所在的整個div的顏色。它不會改變小吃店的顏色。從素材UIi設置小吃店元素的顏色
我正在使用材料UI中的小吃店元素。此時小吃店出現黑色。你知道我可以如何改變顏色嗎?背景顏色只會改變小吃店所在的整個div的顏色。它不會改變小吃店的顏色。從素材UIi設置小吃店元素的顏色
您必須設置bodyStyle
屬性:
<Snackbar bodyStyle={{ backgroundColor: 'teal', color: 'coral' }} />
隨着物質的UI 1.0,你應該覆蓋從SnackbarContent組件根CSS類道具SnackbarContentProps。
下面是一個例子:
const styleSheet = createStyleSheet(() => ({
root: {
background: 'red'
}
}));
class MySnackbar extends Component {
render() {
const { classes } = this.props;
return (
<div>
<Snackbar
SnackbarContentProps={{
classes: {
root: classes.root
}
}}
message={<span>Some message</span>}
/>
</div>
);
}
}
export default withStyles(styleSheet)(MySnackbar);