我正在使用最新版本的react
和semantic-ui-react
我有这个Icon
从语义实现导航到外部链接(github)的元素设置
<Menu.Item
position="right"
to="https://github.com"
as={Link}
>
<Icon name="github" size="big" />
</Menu.Item>
当我单击 UI 中的图标时,它会尝试将 github url 附加到我的 UI 的 url 中。所以我在localhost:blah/someUrl
它正在请求localhost:blah/someUrl/https://github.com
这是否是路由或滥用 <Icon>
的问题 Prop ?
最佳答案
这实际上是对路由器链接的滥用:如果您想链接到外部页面,请不要使用路由器 <Link>
组件。
它将按以下方式工作:
<Menu.Item
href="https://github.com"
position="right"
target="_blank"
>
<Icon name="github" size="big" />
</Menu.Item>
关于reactjs - 语义 UI - 使用 Icon 元素导航到外部链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54950660/