我正在尝试使用React的字体--棒极了。我已经设法从https://fontawesome.com/how-to-use/on-the-web/using-with/react获得了使用stroopwafel图标的示例。这是很好的,但可能不是那么有用。现在我想包含一个更有用的图标:the exclamation mark。然而,这里的命名标准似乎有些问题,因为当我尝试:
import { fa-exclamation-triangle } from '@fortawesome/free-solid-svg-icons'我明白了:Syntax error: Unexpected token, expected ,
当我试着移除那些讨厌的-时
import { faexclamationtriangle } from '@fortawesome/free-solid-svg-icons'我得到了'@fortawesome/free-solid-svg-icons' does not contain an export named 'faexclamationtriangle'.
那么,我怎么知道这些图标叫什么呢?
发布于 2018-09-07 19:27:25
所以这就是诀窍:
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'camelCase和没有讨厌的-。
接下来,当你使用它的时候,你不应该有fa,不应该有camelCase,哦,第二个-呢?去吧,留着它吧!
<FontAwesomeIcon icon="exclamation-triangle"/>令人困惑?是的,我想是的..。
https://stackoverflow.com/questions/52220119
复制相似问题