【问题标题】:Shift menu of material ui to left most side of page将素材ui的菜单移到页面的最左侧
【发布时间】:2021-02-08 03:38:16
【问题描述】:

我想把菜单移到页面的左边,这样中间就没有空格了。但无论我做什么,它都不会向左侧移动。请提出一些解决方案。

以下是我的相关代码:

  <Menu
                 
                  anchorReference="anchorPosition"
                  anchorPosition={{ top: 90, left: 0 }}
                  anchorOrigin={{
                    vertical: "bottom",
                    horizontal: "left",
                  }}
                  transformOrigin={{ vertical: "top", horizontal: "left" }}
                  keepMounted
                  open={open}
                  onClose={handleClose}
                  classes={{ paper: classes.menuPaper }}
                >

类对象的弹出框样式:

 menuPaper: {
backgroundColor: theme.palette.secondary.light,
width: "100%",
maxWidth: "unset",
  },

【问题讨论】:

  • 你试过把边距设为 0 吗?
  • 是的,我做了但无济于事。我认为这与我正在使用的材料 ui 库有关
  • 您能在 Codesandbox 中重新生成您的问题并在此处添加链接吗?
  • 一会儿会做,谢谢

标签: javascript reactjs material-ui next.js


【解决方案1】:

我终于明白了。 popever中有这个props margin treshold。我把它的值设置为 0 并且它起作用了。 @Mateen 部分正确,不是边距,但左侧位置偏移了 16。保证金阈值的默认值。必须将其覆盖为 0。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-15
    相关资源
    最近更新 更多