我从Material UI实现了一个progress stepper,但是我找不到一种方法将它的背景颜色从紫色更改为蓝色。
在documentation之后,我尝试通过在styles上设置progress属性来更改它,但它应用了新的背景色,而不是更改进度条的颜色……
const styles = {
progress: {
backgroundColor: 'blue',
}
};
<MobileStepper
variant="progress"
steps={3}
position="static"
activeStep={this.state.activeStep}
className={classes.progress}
nextButton={
<Button size="small" onClick={this.handleNext} disabled={this.state.activeStep === 2}>
Next
{theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
</Button>
}
backButton={
<Button size="small" onClick={this.handleBack} disabled={this.state.activeStep === 0}>
{theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
Back
</Button>
}
/>这就是它现在的样子:

发布于 2018-10-16 21:38:45
您是否尝试过设置颜色属性而不是backgroundColor属性?
const styles = {
progress: {
color: 'blue',
}
};发布于 2021-05-11 15:11:24
const MobileStepperView = withStyles({
root: {
width: "50%",
flexGrow: 1,
},
colorPrimary: {
backgroundColor: "red",
},
progress: {
backgroundColor: "green",
"& *": {
backgroundColor: "red",
},
},
})(MobileStepper);试试这个,希望能有所帮助。
https://stackoverflow.com/questions/52833403
复制相似问题