2017-09-04 104 views
0

我在节点应用程序上使用bootstrap4的reactstrap impimentation。这是我第一次,我需要一点帮助。我如何使导航栏始终处于折叠状态(不管屏幕大小)? 下面是reactstrap github上页的示例代码:如何使用Reactstrap具有默认折叠导航栏?

class App extends Component { 
    constructor(props) { 
    super(props); 

    this.toggle = this.toggle.bind(this); 
    this.state = { 
     isOpen: false 
    }; 
    } 
    toggle() { 
    this.setState({ 
     isOpen: !this.state.isOpen 
    }); 

render() { 
return (
<Navbar color="inverse" inverse toggleable> 
      <NavbarToggler right onClick={this.toggle} /> 
      <NavbarBrand href="/">reactstrap</NavbarBrand> 
      <Collapse isOpen={this.state.isOpen} navbar> 
      <Nav className="ml-auto" navbar> 
       <NavItem> 
       <NavLink href="/components/">Components</NavLink> 
       </NavItem> 
       <NavItem> 
       <NavLink href="https://github.com/reactstrap/reactstrap">Github</NavLink> 
       </NavItem> 
      </Nav> 
      </Collapse> 
     </Navbar> 
)} 

回答