reactjs - 语义 UI - 使用 Icon 元素导航到外部链接

标签 reactjs semantic-ui

我正在使用最新版本的reactsemantic-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/

相关文章:

javascript - 在 React/Redux 中在屏幕上一一显示内容

javascript - React.children.only 期望接收单个 react 元素子 Navigator

reactjs - react 网格布局html不更新列

javascript - 防止在输入 VueJS/Semantic UI 时提交表单

jquery - 使用 jQuery 将类添加到单击(嵌套)的 div 元素

javascript - 语义 UI 搜索模块不显示 json 响应

reactjs - React-Native - i18n 单独的文件

reactjs - 如何在 Material ui 网格中以不同方式对齐 xs 和 md 的内容

javascript - 语义用户界面 : How to AutoClose Modal?

semantic-ui - Semantic-UI 中响应可见性的正确类是什么?