【发布时间】:2021-02-02 12:31:20
【问题描述】:
我正在使用material-ui。有两个工具栏,其中第二个工具栏想要透明背景
我关注了这个,Transparent AppBar in material-ui (React),但它适用于 AppBar 组件,不适用于工具栏
我的代码:
主题:
const MuiTheme = createMuiTheme({
palette: {
primary: {
main: purple[500],
},
secondary: {
main: green[500],
},
},
mixins: {
toolbar: {
backgroundColor: "transparent",
},
},
});
工具栏文件
const toolbarStyles = makeStyles((theme) => ({
toolbar: {
backgroundColor: theme.mixins.toolbar.backgroundColor,
},
}));
<AppBar position="static" style={{ boxShadow: "none" }}>
<Toolbar className="toptoolBar">
{/* */}
</Toolbar>
<div style={{ backgroundColor: "transparent" }}>
<Toolbar
style={{ backgroundColor: "transparent" }}
classes={{ root: toolbarSt.toolbar }}
>
{/* */}
</Toolbar>
</div>
</AppBar>
【问题讨论】:
标签: reactjs material-ui