小编Rol*_*lam的帖子

MUI - 如何响应式获取 theme.mixins.toolbar.minHeight 值?

我想知道如何使用 muitheme.mixins.toolbar来计算height: calc(100vh - toolbar)

我目前正在尝试做

function SwipeCard() {
  return (
    <Box
      sx={{
        height: (theme) => `calc(100vh - ${theme.mixins.toolbar.minHeight}px)`,
        paddingTop: (theme) => theme.mixins.toolbar.minHeight + "px",
      }}
    >
      hello world
    </Box>
  );
}

export default SwipeCard;

Run Code Online (Sandbox Code Playgroud)

但是当我更改视口大小时,工具栏就会变大。Theme.mixins.toolbar.minHeight保持不变而56不是预期64

javascript css toolbar reactjs material-ui

5
推荐指数
1
解决办法
1213
查看次数

标签 统计

css ×1

javascript ×1

material-ui ×1

reactjs ×1

toolbar ×1