Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
字体';t在自定义变量的ReactJS中工作_Reactjs_Image_Font Awesome - Fatal编程技术网

字体';t在自定义变量的ReactJS中工作

字体';t在自定义变量的ReactJS中工作,reactjs,image,font-awesome,Reactjs,Image,Font Awesome,我在reactJS单页应用程序项目中工作。在这一点上,我感到惊讶的字体真棒是不工作的。我真的不知道为什么这部分不起作用。这是我的密码 .profileImage { position: relative; &:after{ content:'\f107'; position: absolute; right: -10px; top: 50%; transform: translateY(-50

我在reactJS单页应用程序项目中工作。在这一点上,我感到惊讶的字体真棒是不工作的。我真的不知道为什么这部分不起作用。这是我的密码

.profileImage {
    position: relative;
    &:after{
        content:'\f107';
        position: absolute;
        right: -10px;
        top: 50%;
        transform: translateY(-50%);
        width: 10px;
        height: 10px;
        font-size: 12px;
        font-family: $fa-font-path;
    }
}

$fa字体路径这是一个自定义变量。

如果要在css中使用FA,请确保已安装FA

npm install --save font-awesome
并补充说

import 'font-awesome/css/font-awesome.min.css

在您的
index.tsx

中,这与react没有任何关系。如果它不起作用,您还有其他问题,FA应该像在其他任何环境中一样工作。您安装了font Aweasome吗?@ShubhamRaj没有,但我有font Aweasome C软件,但font family不是应该是“font family:FontAweasome”;而$FA font path应该是FA文件文件夹的路径(如“$FA font path://fonts”!default;”)?我还没有把它的字体钉死。。。好啊你是说你添加了cdn还是什么?