加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

reactjs – 如何从react-icons包扩展(大)font-awesome图标

发布时间:2020-12-15 09:32:25 所属栏目:百科 来源:网络整理
导读:我正在使用marvelouse react-icons包( http://gorangajic.github.io/react-icons/fa.html),特别是字体真棒包. 如果这没有反应,那么I would just add an attribute to the tag,如: i class="fa fa-camera-retro fa-5x"/i 但是,如果我将fa-5x添加到FaFolderOp
我正在使用marvelouse react-icons包( http://gorangajic.github.io/react-icons/fa.html),特别是字体真棒包.

如果这没有反应,那么I would just add an attribute to the tag,如:

<i class="fa fa-camera-retro fa-5x"></i>

但是,如果我将fa-5x添加到FaFolderOpen标记中,它就不会执行任何操作.正如你所看到的,我正在使用react-bootstrap,并将图标设置为一个按钮(它应该是一个块)吗?

我不得不相信以前曾经问过,但我没有通过搜索找到它.

这是它的样子,我希望它更大:

enter image description here

const React = require('react')
import { Form,FormControl,FormGroup,ControlLabel,Col,Button,Tooltip,OverlayTrigger } from 'react-bootstrap'
import FaFolderOpen from 'react-icons/lib/fa/folder-open'
import FaFileCodeO from 'react-icons/lib/fa/file-code-o'
import FaFolderOpen from 'react-icons/lib/fa/folder-open'
import FaFileCodeO from 'react-icons/lib/fa/file-code-o'

<Button type="button" bsStyle="success" block onClick={(e) => folderChooser(e)}>
     <FaFolderOpen />
</Button>

解决方法

如果你想要一个5倍的图标大小,你需要将它作为大小传递给反应类

// Font awesome pixel sizes relative to the multiplier. 
// 1x - 14px
// 2x - 28px
// 3x - 42px
// 4x - 56px
// 5x - 70px

<FaFolderOpen size={70} />

如果你注意到它每次跳跃14

from the github readme它显示所有内容都被覆盖.它渲染一个svg所以你不能使用5x你必须使用像素大小

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读