'material-ui'不包含名为'withStyles'的导出

时间:2018-04-20 09:43:32

标签: javascript ecmascript-6 material-ui

我的package.json看起来像这样。该应用程序工作正常,直到不久前突然我收到此错误。

import profileCardStyle from "assets/jss/material-dashboard-react/profileCardStyle";

function ProfileCard({ ...props }) {
const { classes, subtitle, title, description, footer, avatar } = props;
return (
<Card className={classes.card}>
<CardHeader
classes={{
root: classes.cardHeader,
avatar: classes.cardAvatar
}}
avatar={<img src={avatar} alt="..." className={classes.img} />}
/>
<CardContent className={classes.textAlign}>
{subtitle !== undefined ? (
<Typography component="h6" className={classes.cardSubtitle}>
{subtitle}
</Typography>
) : null}
{title !== undefined ? (
<Typography component="h4" className={classes.cardTitle}>
{title}
</Typography>
) : null}
{description !== undefined ? (
<Typography component="p" className={classes.cardDescription}>
{description}
</Typography>
) : null}
</CardContent>
<CardActions className={classes.textAlign + " " + classes.cardActions}>
{footer}
</CardActions>
</Card>
);
}

ProfileCard.propTypes = {
classes: PropTypes.object.isRequired,
title: PropTypes.node,
subtitle: PropTypes.node,
description: PropTypes.node,
footer: PropTypes.node,
avatar: PropTypes.string
};

export default withStyles(profileCardStyle)(ProfileCard);

我的组件看起来像这样 从“反应”中导入React;     import {     withStyles,     卡,     CardHeader,     CardContent,     CardActions,     活版印刷     来自“material-ui”;     从“prop-types”导入PropTypes;

<import resource="classpath:path/to/another/maven/module/context.xml" />

1 个答案:

答案 0 :(得分:1)

您需要导入MUI的withStyles

import { withStyles } from 'material-ui/styles'