gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 02:02:44 25 4
gpt4 key购买 nike

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

    "@material-ui/icons": "1.0.0-beta.42",
"chartist": "0.10.1",
"classnames": "2.2.5",
"material-ui": "1.0.0-beta.41",
"npm-run-all": "4.1.2",
"perfect-scrollbar": "1.3.0",
"react": "16.2.0",
"react-chartist": "0.13.1",
"react-dom": "16.2.0",
"react-google-maps": "9.4.5",
"react-router-dom": "4.2.2",
"react-scripts": "1.0.17",
"react-swipeable-views": "0.12.12"

我的组件看起来像这样从“ react ”导入 react ; 进口 { 与样式, 卡片, 卡头, 卡片内容, 卡行动, 版式 } 来自“material-ui”; 从“prop-types”导入 PropTypes;

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);

最佳答案

您需要导入MUI的withStyles:

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

关于javascript - “material-ui”不包含名为 'withStyles' 的导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49938718/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com