我有一个React语义Ui菜单,它必须链接到另一个页面。 我试图用一个锚标记来包装它,但这完全破坏了菜单按钮上的样式。在假设是但是之前,我想我是做错了。
这就是我的代码当前的样子:
<Menu tabular attached='top'> <a href={item1Url}><Menu.Item link>item1</Menu.Item></a> <a href={item2Url}><Menu.Item active link>Item 2</Menu.Item></a> </Menu>
在包装之前 Menu.Item 与 a 标签,这是它现在的样子:
Menu.Item
a
与 一 标签包装它,它看起来像这样:
一
更不用说当我在上面盘旋的时候它就完全消失了。我做错什么了吗?
如果你看看 the doc ,您可以直接添加 href (和 target )属性到 Menu.Item 元素。
href
target
在您的情况下,结果将是:
<Menu tabular attached='top'> <Menu.Item href="item1Url">item1</Menu.Item></a> <Menu.Item href="item2Url"active>Item 2</Menu.Item></a> </Menu>