简体   繁体   English

如何改变下划线颜色 <Select/>通过设置类

[英]How to change underline color of <Select/> by setting classes

const styles = {
 inkbar: {
  '&:after': {
   backgroundColor: 'red',
   height: '2px'
 }
},
 underline:{
 '&:before':{
  height:'2px',
  backgroundColor:'green'
}
}
};

  <Select
      fullWidth
      value={this.props.value}
      onChange={this.props.onChange}
      input={
        <Input
          classes={{    
            inkbar:this.props.classes.inkbar,
            underline:this.props.classes.underline}}
        />
      }
    >
      {this.props.children}
    </Select>)

But when I check code with react tool, I found the classes of <Input> component did not change. 但是当我使用react工具检查代码时,我发现<Input>组件的类没有改变。 Does anyone know how to change the color of inkbar and underline in <Select> component? 有谁知道如何更改墨盒的颜色和<Select>组件中的下划线?

I use Material-ui v1.0.0-beta 我使用Material-ui v1.0.0-beta


I have soloved by setting className. 我通过设置className来解决问题。 But I still want to know why changing classes does not work. 但我仍然想知道为什么改变班级不起作用。

而不是classes使用className ,有关更多信息,请检查此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM