我正在使用 react material design 和 redux 并且我有一个类组件。我正在尝试向 rmd 快速拨号组件添加一些自定义样式,这是我的组件:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withStyles, makeStyles } from '@material-ui/core/styles';
import { SpeedDial, SpeedDialIcon, SpeedDialAction } from '@material-ui/lab';
const useStyles = makeStyles((theme) => ({
speedDial: {
position: 'absolute'
}
}));
const actions = [...]
class ToolBar extends Component {
render() {
let { classes } = this.props;
return (
<SpeedDial
ariaLabel="SpeedDial Tools"
icon={<SpeedDialIcon />}
className={classes.speedDial}
open={this.state.open}>
{actions.map((action) => (
<SpeedDialAction
key={action.name}
icon={action.icon}
tooltipTitle={action.name}
/>
))}
</SpeedDial>
)
}
}
const mapStateToProps = state => ({...})
export default connect(mapStateToProps, null)(withStyles(useStyles)(ToolBar))
我已经根据 rmd 文档为主题配置完成了所有其他事情,但这是我得到的结果:
将添加该类,但 css 无法正确呈现