【问题标题】:How can I add href to Icon for Ant Design?如何在 Ant Design 的 Icon 中添加 href?
【发布时间】:2021-03-04 17:29:57
【问题描述】:

如何向图标添加 Url 链接?


  <Space>
       <a href={team.github}>
          <GithubOutlined className="teamSocialIcon" />
       </a>
       <a href={team.linkedin}>
          <LinkedinFilled className="teamSocialIcon" />
       </a>
    </Space>

【问题讨论】:

    标签: reactjs antd ant-design-pro


    【解决方案1】:

    您可以使用 Ant Design 的 Button 组件并将类型更改为“文本”或“链接”。

    <Button type="text" href={team.github}>
      <GithubOutlined className="teamSocialIcon" />
    </Button>
    

    <Button type="text" href={team.github} icon={<GithubOutlined className="teamSocialIcon" />} />
    

    但我通常会创建一个将这两者结合起来的组件以添加更多自定义功能。

    【讨论】:

      猜你喜欢
      • 2018-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-12
      • 2019-10-22
      • 2023-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多