我的应用程序正在使用Material-UI和material-table。使用“ ThemeProvider”将全局主题应用于“ index.js”文件中,然后将其作为子主题:
<Fragment>
<CssBaseline />
<MenuAppBar />
<main className={classes.main}>
<Route path="/" exact component={Home} />
<Route path="/login" component={Login}></Route>
</main>
</Fragment>
该组件将具有带物料表的组件。当我添加表格组件并查看该页面时,AppBar松开了其中的某些样式,例如Pofile和注销(https://material-ui.com/components/app-bar/#app-bar-with-menu)的下拉按钮中的背景颜色和对齐方式。我不知道为什么会这样。
在CSS上,更改了AppBar样式的页面上,我看到.MuiPaper-root
在.MuiAppBar-colorPrimary
之前被导入,因此覆盖了样式,但是仍然不确定为什么要添加带有“材料表”导致这种情况发生。
我的应用依赖项是:
"dependencies": {
"@material-ui/core": "^4.2.1",
"@material-ui/icons": "^4.2.1",
"axios": "^0.19.0",
"jwt-decode": "^2.2.0",
"material-table": "^1.40.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1",
"react-svg": "^10.0.11"
},
我还看到“ material-table”列出了“ material-ui / core”的两个不同版本,但不确定如何解决。
"material-table": {
"version": "1.40.1",
"resolved": "https://registry.npmjs.org/material-table/-/material-table-1.40.1.tgz",
"integrity": "sha512-rZuGhNpXFzROlqJUVLH+E5yzt9MxaYVZfDNuHWtM9EWlbUGQJWuGQNcsSmdr0XeTCZkQvVnZYbEkRcUu+71rfQ==",
"requires": {
"@date-io/date-fns": "^1.1.0",
"@material-ui/core": "^4.0.1",
"@material-ui/pickers": "^3.0.0",
"classnames": "^2.2.6",
"date-fns": "^2.0.0-alpha.27",
"debounce": "^1.2.0",
"filefy": "0.1.9",
"prop-types": "^15.6.2",
"react-beautiful-dnd": "11.0.3",
"react-double-scrollbar": "0.0.15"
},
"dependencies": {
"@material-ui/core": {
"version": "4.2.1",
...