CardHeader未在React中呈现

时间:2018-08-07 14:23:38

标签: reactjs material-ui

我正在使用React和material-ui,其他的东西也起作用了,但是由于某种原因<CardHeader>没有被渲染。 下面是代码

import React from "react";
import Card from "@material-ui/core/Card";
import CardHeader from "@material-ui/core/Card";
import CardContent from "@material-ui/core/Card";
import CardActions from "@material-ui/core/Card";
import Button from "@material-ui/core/Button";
import Paper from "@material-ui/core/Paper";
import Typography from "material-ui/Typography";

class PaperCard extends React.Component {
  render() {
    return (
      <Card>
        <CardHeader title="CaHellord" subheader="Test ME" />
        <CardContent>
          <Typography type="title">Word of the day</Typography>
          <Typography type="headline" component="h2">
            impediments
          </Typography>
          <Typography component="p">adjective</Typography>
        </CardContent>
        <CardActions>
          <Button dense> Learn More </Button>
        </CardActions>
      </Card>
    );
  }
}

export default PaperCard;

有人能指出我错过的明显之处吗?

1 个答案:

答案 0 :(得分:2)

只是错误导入的情况。

替换从

导入的CardHeader
import CardHeader from "@material-ui/core/Card";

import CardHeader from "@material-ui/core/CardHeader";