是否可以在材质中为网格内的所有字段设置样式-ui?
我已经知道如何在CSS中做到这一点,但我无法在jss中找到如何做到这一点
我试过这个但不行:
我已经知道如何在CSS中做到这一点,但我无法在jss中找到如何做到这一点
我试过这个但不行:
const styles = { shopForm: { textAlign : 'center',Field :{ width: '60%' }};
我该如何改变风格?
这种风格可以在jss中使用吗?
在css过去这样做:
.shopForm Field {...}
我正在使用材料-ui
<Grid item lg={4} className={classes.shopForm}> <Field name="name" type="text" label="name" component={TextField} /> <Field name="plaque" type="text" label="plaque" component={TextField} /> <Field name="unit" type="text" label="unit" component={TextField} /> <Field name="text" type="text" label="text" component={TextField} multiline row={3} /> </Grid>
解决方法
一段时间后找到某种答案!
样式字段组件本身是不可能的,因为它由其他元素组成,但您可以设置在materialUI组件内的元素:
样式字段组件本身是不可能的,因为它由其他元素组成,但您可以设置在materialUI组件内的元素:
shopForm: { textAlign : 'center','& input' :{ width: '60%',color:'grey' },'& label':{ fontSize:'15px' }
因此,您必须首先找到要设置样式的元素,然后将样式赋予父类.
<Grid item lg={4} className={classes.shopForm}> <Field name="name" type="text" label="name" component={TextField} /> <Field name="plaque" type="text" label="plaque" component={TextField} /> <Field name="unit" type="text" label="unit" component={TextField} /> <Field name="text" type="text" label="text" component={TextField} multiline row={3} /> </Grid>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。