[英]Semantic UI Sidebar Issue ( Sidebar separating line is not visible)
I have Home, Contact and About menu in sidebar and I want a separation line between these menus.我在侧边栏中有“主页”、“联系人”和“关于”菜单,我希望在这些菜单之间有一条分隔线。 In semantic UI react showing these separations but on screen not showing.在语义 UI 中反应显示这些分离但在屏幕上不显示。 My React code is below我的 React 代码如下
import "./styles.css";
import React, { Component } from 'react'
import { Sidebar, Menu } from 'semantic-ui-react'
export class SidebarComponent extends Component {
state = { activeItem: 'Home' }
handleItemClick = (e, { name }) => this.setState({ activeItem: name })
render() {
const { activeItem } = this.state
return (
<div>
<Sidebar
as={Menu}
animation='overlay'
icon='labeled'
inverted
vertical
visible
width='small' >
<Menu.Item
name='Home'
active={activeItem === 'Home'}
onClick={this.handleItemClick}
>
Home
</Menu.Item>
<Menu.Item
name='Contact'
active={activeItem === 'Contact'}
onClick={this.handleItemClick}
>
Contact
</Menu.Item>
<Menu.Item
name='About'
active={activeItem === 'About'}
onClick={this.handleItemClick}
>
About
</Menu.Item>
</Sidebar>
</div>
)}}
export default SidebarComponent;
After running my code I got this type of output ( Output image below) Current Output运行我的代码后,我得到了这种类型的 output(下图为 Output)当前 Output
But I want this type of output (below) Required Output但是我想要这种类型的 output(下) 必填 Output
2 ways in which you can add a divider-添加分隔线的 2 种方法-
import Divider from semantic-ui-react.从 semantic-ui-react 导入 Divider。
import { Sidebar, Menu, Divider } from 'semantic-ui-react'
And add this line of code after the first and second Menu.Item并在第一个和第二个 Menu.Item 之后添加这行代码
<Divider fitted />
in styles.css add -在 styles.css 添加 -
.ui.vertical.menu .item{
border-bottom: 1px solid #000000;
}
this will add border-bottom for every item.这将为每个项目添加边框底部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.