gpt4 book ai didi

css - Material ui - makeStyles 无法正确创建样式

转载 作者:行者123 更新时间:2023-11-28 13:57:53 27 4
gpt4 key购买 nike

<分区>

当我使用 withStyles + makeStyles 的 material-UI 时,它不会创建正确的 css,但会返回正确的类名。

例如,对于那个组件:

import React, { Component } from 'react'
import { Container, CssBaseline, Grid } from '@material-ui/core';
import { makeStyles, withStyles } from '@material-ui/styles';

const styles = makeStyles(theme => ({
letMeCheck: {
backgroundColor: 'red'
}
}));

class App extends Component {
render() {
const { classes } = this.props;

return (
<Container maxWidth="lg">
<CssBaseline />
<Grid container>
<Grid className={classes.letMeCheck} item xs={12} sm={6}>
A
</Grid>
<Grid item xs={12} sm={6}>
B
</Grid>
</Grid>
</Container>
);
}
}

export default withStyles(styles)(App);

(我正在使用 chrome 的检查器)网格的 div 确实有类“App-letMeCheck-2”但是类风格是:

.App-letMeCheck-2 {
0: m;
1: a;
2: k;
3: e;
4: S;
5: t;
6: y;
7: l;
8: e;
9: s;
10: -;
11: l;
12: e;
13: t;
14: M;
15: e;
16: C;
17: h;
18: e;
19: c;
20: k;
21: -;
22: 1;
}

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