字体图标MUI v5不显示



我正在尝试使用Material UI v5中的图标类,我将以下内容添加到我的index.html

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />

然后我用

import { Icon} from '@mui/material';
<Icon color="inherit">file_download</Icon>

但我的图标仍然不显示

您可以尝试将导入路径更改为import Icon from '@mui/material/Icon';

我终于设法通过在我的index.html文件中添加所有图标来工作

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp">

我认为如果你没有在样式表中指定所有的图标,有些图标就不起作用了

最新更新