[英]react-bootstrap: Nav without NavItem?
Maybe I am just stupid or prejudiced, but I really really don't like NavItem
. 也许我只是愚蠢或偏见,但我真的不喜欢
NavItem
。 The fact that it is an <a>
wrapped inside an <li>
enforces a lot of rules that I don't want to abide by. 事实上它是一个包含在
<li>
的<a>
强制执行许多我不想遵守的规则。 I just want to create my own Navbar using the Bootstrap stylings, but with my own elements, like <Button>
, <ButtonGroup>
, maybe an unclickable image or even a search box. 我只是想使用Bootstrap样式创建我自己的Navbar,但是使用我自己的元素,如
<Button>
, <ButtonGroup>
,可能是一个不可点击的图像,甚至是一个搜索框。
Which leads me to my question: What is the easiest way to get rid of NavItem
and get (somewhat) properly styled, ordered elements? 这引出了我的问题:什么是最简单的方法来摆脱
NavItem
并得到(有些)正确的样式,有序元素?
If I simply put a <li><Button>...</Button></li>
in <Nav>
, it complains about properties that are not expected by <li>
. 如果我只是在
<Nav>
放置<li><Button>...</Button></li>
<Nav>
,它会抱怨<li>
不期望的属性。 I tried replacing <Nav>
with my own <ul>
while copying all it's properties and it still did not work out well. 我尝试用我自己的
<ul>
替换<Nav>
,同时复制它的所有属性,但它仍然没有很好用。 I imagine, just playing around like that will eventually work but easily break in the future because I am not respecting some of Navbar
's design considerations. 我想,只是这样玩游戏最终会起作用,但将来很容易打破,因为我不尊重
Navbar
的一些设计考虑因素。
Is Navbar
only to be used with <Nav>
and links? Navbar
只能与<Nav>
和链接一起使用吗? If I want non- elements in my bar, do I have to do the whole thing from scratch? 如果我想在我的栏中使用非元素,我是否必须从头开始做所有事情? There must be a better solution...?
一定有更好的解决方案......?
我认为您发现制作组件或更改引导程序组件更容易
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.