【问题标题】:How to have default collapsed Navbar with Reactstrap?如何使用 Reactstrap 设置默认折叠的导航栏?
【发布时间】:2018-02-13 03:43:59
【问题描述】:

我在节点应用程序上使用了 bootstrap4 的 reactstrap impimentation。这是我的第一次,我需要一点帮助。如何让导航栏一直折叠(无论屏幕大小)? 这是来自 reactstrap github 页面的示例代码:

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>
)}

【问题讨论】:

    标签: reactjs bootstrap-4 reactstrap


    【解决方案1】:

    这可能会有所帮助。

    文档中有一个示例。 https://reactstrap.github.io/components/navbar/

    渲染(){ 返回 ( 反应带 成分 Github );

    【讨论】:

      猜你喜欢
      • 2019-01-01
      • 2018-01-21
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      • 2021-12-27
      • 1970-01-01
      相关资源
      最近更新 更多