reactjs - 向material-ui AppBar组件添加垂直分隔线

标签 reactjs material-ui

我们如何为 AppBar 设置垂直分隔线,如 muicss's Left/Right divider component

仅插入 height: 100% 的 div 元素是行不通的。

<AppBar position="static" color="default">
  <Toolbar>
    <Typography type="title" color="inherit">
      Title
    </Typography>
    <div style={{
      border: 'solid #ff0000',
      height: '100%'
      }}>
    </div>
    <Typography type="title" color="inherit">
      Title 2
    </Typography> 
  </Toolbar>
</AppBar>

这是实时示例代码。 https://codesandbox.io/s/54070o6v2x

谢谢。

我的环境

| Tech         | Version |
|--------------|---------|
| Material-UI  | next    |
| React        | 16.2.0  |
| Browser      | Chrome 63.0.3239.84 |

最佳答案

这也可以用于垂直菜单栏分隔线:

<Divider orientation="vertical" flexItem />

请参见此处:https://material-ui.com/components/dividers/

关于reactjs - 向material-ui AppBar组件添加垂直分隔线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48247562/

相关文章:

reactjs - React-intl const <FormattedMessage/> 给出 [object object] 作为结果

reactjs - 如何在 Formik 中从 material-ui-phone-number 提交 MuiPhoneNumber

javascript - 使表格可滚动

javascript - Material ui Select 和 'redux-form' 出现意外行为

javascript - 为什么我所需的库没有从 ES6 转换为 ES5?

javascript - 类型错误 : Cannot read property 'name' of null

javascript - 鼠标悬停在子弹图上

material-ui - Material ui 在 Next js 中刷新时中断

reactjs - 将映射数据传递给 Material-UI 模态

ruby-on-rails - 使用 react-rails gem 时 React 组件不呈现