无法将svg图标添加到Material UI中的CardHeader

时间:2018-01-06 16:58:12

标签: reactjs material-ui

我使用的是materi-ui版本V0.18.7。

我正在尝试将Edit svg图标添加到CardHeader但它没有出现。我试图弄清楚为什么它没有出现但没有运气。

import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
import Edit from 'material-ui/svg-icons/Editor/mode-edit';

<Card>
                     <CardHeader
                          title="Without Avatar"
                          subtitle="Subtitle"
                          openIcon={<Edit />}
                        />

                    <CardText>
                      Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                      Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi.
                      Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque.
                      Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio.
                    </CardText>


                  </Card>

1 个答案:

答案 0 :(得分:1)

试试这个:

import Edit from 'material-ui/svg-icons/editor/mode-edit';
...
<CardHeader
  title="Without Avatar"
  subtitle="Subtitle"
  actAsExpander={true}
  showExpandableButton={true}
  openIcon={<Edit />}
  closeIcon={<Edit />}
/>
...
<CardText expandable={true}>