我正在尝试 React Bootstrap 并想要更改自定义导航。我正在做这样的事情。
const navInstance = (
<Nav bsStyle='pills'>
<NavItem eventKey={1} href='/home'>NavItem 1 content</NavItem>
</Nav>
);
React.render(navInstance, document.querySelector('.container'));
关于如何更改颜色有什么想法吗?另外,我如何将导航附加到顶部,以便当页面滚动时,导航保持固定?
最佳答案
我相信您缺少作为父级的导航栏组件。您的组件应如下所示:
<Navbar fixedTop>
<Nav>
<NavItem eventKey={1} href='#'>Link</NavItem>
<NavItem eventKey={2} href='#'>Link</NavItem>
</Nav>
</Navbar>
fixedTop 属性将通过从 bootstrap.css 添加适当的类来保持其固定。颜色的更改将覆盖 css 类,您应该可以开始了。
关于twitter-bootstrap - 如何在 React Bootstrap 上自定义组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30550854/