我正在使用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;
有人能指出我错过的明显之处吗?
答案 0 :(得分:2)
只是错误导入的情况。
替换从
导入的CardHeader
import CardHeader from "@material-ui/core/Card";
到
import CardHeader from "@material-ui/core/CardHeader";