【问题标题】:Can the Drawer be permanent and lay over the content?抽屉可以是永久性的并覆盖内容吗?
【发布时间】:2019-05-10 11:02:43
【问题描述】:

我想在屏幕左侧有一个迷你抽屉,就像Material UI Documentation 上的示例:

但在我的情况下,我希望它在打开时浮动在内容上(如组件的 variant="temporary" 版本),因为它当前会推送内容。

如果我处理 open 属性来动态更改变体样式,它看起来不太好。

有什么方法可以实现吗?

【问题讨论】:

    标签: reactjs typescript navigation-drawer material-ui


    【解决方案1】:

    如果你这样设置内容的样式,它的位置不会受到抽屉状态的影响,因为你将它的位置设置为绝对:

    content: {
        position: "absolute",
        marginLeft: theme.spacing.unit * 7 + 1,
        padding: theme.spacing.unit * 3
      }
    

    当您打开抽屉时,标题文本当然会向左移动。

    编辑:我要离开 codesanbox Material UI demo 以获取迷你变体抽屉。

    【讨论】:

      猜你喜欢
      • 2021-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 2018-12-06
      • 2020-01-21
      • 1970-01-01
      相关资源
      最近更新 更多