6
如何将 material-ui 的样式参数移到其他文件
source link: https://www.v2ex.com/t/795930
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
前端初学者,目前在学习 material-ui 的使用,遇到如下问题 例如一个 Grid
<Grid
container
direction="row"
justifyContent="center"
alignItems="center"
/>
经过 prettier 格式化后,参数占用了太多行,导致结构看起来不清晰,我希望把 container,direction 等参数移动到其他文件里,如
<Grid class={"grid-root"}/>
grid-root: {
container
direction="row"
justifyContent="center"
alignItems="center"
}
目前看到的办法
一个是自定义<Mygrid>,这种的问题是 grid 比较多的话需要自定义很多 grid,改起来不好改,
一个是用 material-ui 自带的 makeStyles,但是好像只能使用 css 的参数,我更想使用 material 的参数。
想请教正式项目中如何处理这一类问题。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK