reactjs - MUI dark theme isn't applied to the background
问题描述
I have my react application where I want to apply MUI darkBaseTheme
. Without it, part of my app looks like this:
After I wrap all the html stuff in my render()
with:
<MuiThemeProvider muiTheme={getMuiTheme(darkBaseTheme)}>
</MuiThemeProvider>
Having those imports:
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; // add
import RaisedButton from 'material-ui/RaisedButton'; // add
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import darkBaseTheme from 'material-ui/styles/baseThemes/darkBaseTheme';
It looks like this:
So it changed RaisedButtons
. I know it shouldn't change html ones. But why didn't it change the background to dark? Is there a way to do this, or do I have to do it manually without MUI?
解决方案
您需要<CssBaseline />
在应用程序的根目录中包含该组件,因为这涉及更改主体上的背景颜色。
推荐阅读
- sql-server - 加快 FireDAC 上旨在保存为流的大型数据集的检索
- javascript - .this 元素中的 jQuery 最接近()不起作用
- symfony - 如何存储来自实体类型选择框(Symfony)的数据?
- c# - dSYM 文件夹和 mSYM 文件夹有什么区别?
- visual-studio - Visual Studio 2015 中的 Angular2=>Angular 5.2 更新后启动速度非常慢
- swift - 使用未解析的标识符“kUTTypePDF”
- angular - fxFlex 角度弹性布局无法按预期版本 7.0.0-beta.19 工作
- c++ - c++单链表分段错误t
- python - 如何将动态值传递给 xml 文件?
- javascript - 如何自定义复选框