css - 使用 makeStyles 的 MUI className 不应用 css 实现,但 style 呢?
问题描述
我在这里有我的代码,'DisplayPage'useStyle 中的宽度不起作用。但是,当我应用 style={{width: calc(100% - ${drawerWidth}px)
}} 时,它开始工作。对某些人来说它可以工作,但在某些情况下它们不起作用,这很令人困惑。不太确定要实现哪些样式的因素是什么?
我如何知道何时会应用 makeStyles?
const drawerWidth = 240;
// MUI Setting
const useStyles = makeStyles((theme) => ({
displayPage: {
[theme.breakpoints.up('sm')]: {
marginLeft: drawerWidth,
height: `100%`,
width: `calc(100% - ${drawerWidth}px)`,
},
[theme.breakpoints.up('xs')]: {
width: '100%',
height: `calc(100% - 64px)`,
},
},
}));
<div
className={classes.displayPage}
style={{ width: `calc(100% - ${drawerWidth}px)` }}
>
export default connect(mapStateToProps, mapDispatchToProps)(App);
解决方案
推荐阅读
- html - 如何单击阴影 Cypress.io 内的按钮
- c# - 为什么使用 ObjectARX 中的命令创建的视口不保存到数据库中?
- string - “String”类型不是“FontStyle”类型的子类型
- jquery - jQuery/Ajax 请求中的结果奇数加倍
- java - 速度从 1.7 升级到 2.0
- string - Powershell 中的字符串操作
- homebrew - 为什么 Homebrew 找不到公式?
- java - Spring Boot JPA 存储库查询
- java - 是否可以在java中获取引用变量的地址
- sql - SQL Server 2017 中的 CTE 递归