【问题标题】:Font Icons MUI v5 not showing字体图标 MUI v5 未显示
【发布时间】:2022-06-13 20:56:48
【问题描述】:

我正在尝试使用 Material UI v5 中的 Icon 类,我在 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>

但我的图标仍然不显示

【问题讨论】:

标签: reactjs material-ui


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    我终于设法通过在我的 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">
    

    如果您不在样式表中指定所有图标,我认为某些图标不起作用

    【讨论】:

      猜你喜欢
      • 2021-12-13
      • 2017-09-06
      • 2018-12-07
      • 2022-06-21
      • 2018-12-24
      • 2021-12-09
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多