0

当我专注于输入字段时,我正在尝试更改我的输入字段边框。当前它正在显示blue。我想将其更改为red其他颜色。

我尝试使用传递道具

function Control(props) {
  console.log(props)
  return (
    <TextField
      fullWidth
      InputProps={{
        inputComponent,
        inputProps: {
          className: props.selectProps.classes.input,
          inputRef: props.innerRef,
          children: props.children,
         classes:{underline: props.selectProps.classes.underlineInput,
          root: props.selectProps.classes.inputRoot,
          focused: props.selectProps.classes.focusedLabel,},

          ...props.innerProps
        }
      }}
      {...props.selectProps.textFieldProps}
    />
  );
}

underline: props.selectProps.classes.underlineInput试图更改我的输入字段边框颜色。但它不起作用,为什么?

这是我的代码 https://codesandbox.io/s/71267zp3l6

4

1 回答 1

0

在您的 CSS 文件中添加此类。它!important用于覆盖。

.MuiInput-underline-44:after {
    border-bottom: 2px solid #9f3063 !important;
}
于 2019-05-28T07:32:07.003 回答