Reactjs 如何更新材质ui按钮焦点样式?
material ui介绍了一种使用classname设置组件样式的方法。我有一个按钮组件,如下所示。它使用createStyles和withStyles将样式作为类注入组件。但我不知道如何设置按钮的焦点样式Reactjs 如何更新材质ui按钮焦点样式?,reactjs,material-ui,Reactjs,Material Ui,material ui介绍了一种使用classname设置组件样式的方法。我有一个按钮组件,如下所示。它使用createStyles和withStyles将样式作为类注入组件。但我不知道如何设置按钮的焦点样式 Psuedo选择器可以通过以下方式添加: const styles = createStyles({ button: { // main styles, "&:focus": { color: "red" } } }); 这应该能奏
Psuedo选择器可以通过以下方式添加:
const styles = createStyles({
button: {
// main styles,
"&:focus": {
color: "red"
}
}
});
这应该能奏效
overrides: {
MuiButton: {
root: {
'&:focus': {
color: 'rgba(0, 0, 0, 0.87)',
backgroundColor: 'rgba(0, 0, 0, 0.87)',
},
},
},
},
单击按钮时,我们设置了什么操作?而不是“&:焦点”?
overrides: {
MuiButton: {
root: {
'&:focus': {
color: 'rgba(0, 0, 0, 0.87)',
backgroundColor: 'rgba(0, 0, 0, 0.87)',
},
},
},
},