假设您的useStyles文件看起来像这样:
import makeStyles from "@material-ui/core/styles/makeStyles";
const useStyles = makeStyles({
hideCheckboxAndRadio: {
"& input[type='checkbox'], & input[type='radio']": {
display: "none"
}
}
});
export default useStyles;
回到您的组件上,只需导入此文件并将其附加到您希望隐藏其所有子input类型radio&的父级checkbox
import useStyles from "./useStyles";
function App() {
const classes = useStyles();
return (
<div className={classes.hideCheckboxAndRadio}>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
</div>
);
}
MM们
白板的微信
相关分类