【发布时间】:2020-10-30 23:41:03
【问题描述】:
我正在尝试在主题中为包含、主要和悬停的按钮提供覆盖。我试过了,但它不起作用
CODESANDBOX 链接 CLICK HERE
主题/覆盖/MuiButton.js
import palette from '../palette';
export default {
contained: {
backgroundColor: '#FFFFFF',
'&.primary': {
'&:hover': {
backgroundColor: palette.primary.dark,
},
},
},
};
主题/覆盖/index.js
import MuiButton from "./MuiButton";
export default {
MuiButton
};
主题/index.js
import { createMuiTheme } from "@material-ui/core";
import palette from "./palette";
import typography from "./typography";
import overrides from "./overrides";
const theme = createMuiTheme({
palette,
typography,
overrides,
zIndex: {
appBar: 1200,
drawer: 1100
}
});
export default theme;
【问题讨论】:
-
你在 CSS 中没有 SCSS 语法...
-
@DennisVash 他正在使用 Material Ui,所以不管他是否安装了 sass。
-
谁说你在材质 UI 样式中有 scss?你有资源吗? - NVM 这里有一个例子:material-ui.com/styles/basics/#nesting-selectors,好像 MUI 使用 JSS 作为源
-
@DennisVash。我正在使用 JSS
-
请展示您如何尝试利用这些样式。理想情况下,包括一个 code sandbox 来展示您的问题。
标签: css reactjs material-ui jss react-material