【问题标题】:increasing the width of select dropdown for material ui增加材质ui的选择下拉菜单的宽度
【发布时间】:2019-05-06 09:43:07
【问题描述】:
  • 我正在尝试将下拉菜单的宽度增加到 400 像素。
  • 所以我提供了内联样式,但它仍然没有改变。
  • 当我调试时,我发现宽度来自这个类。
  • 不确定如何覆盖。
  • 你能告诉我如何解决它吗?
  • 在下面提供我的代码 sn-p。

https://stackblitz.com/edit/react-4xmiuz?file=demo.js

<div style={{ width: '400', border: '1px solid green' }}
          className={classes.root}>

        <FormControl style={{ width: '400', border: '1px solid green' }}
            variant="outlined" className={classes.formControl}>
          <InputLabel
            ref={ref => {
              this.InputLabelRef = ref;
            }}
            htmlFor="outlined-age-native-simple"
            style={{ width: '400', border: '1px solid green' }}

          >
            Age
          </InputLabel>
          <Select
            native
            value={this.state.age}
            onChange={this.handleChange('age')}
            style={{ width: '400 !important', border: '1px solid red' }}
            input={
              <OutlinedInput
                name="age"
                labelWidth={this.state.labelWidth}
                id="outlined-age-native-simple"
                style={{ width: '400', border: '1px solid green' }}

              />
            }
          >
            <option style={{ width: '400', border: '1px solid green' }}
              value="" />
            <option style={{ width: '400', border: '1px solid green' }}
              value={10}>Ten</option>
            <option style={{ width: '400', border: '1px solid green' }}
              value={20}>Twenty</option>
            <option style={{ width: '400', border: '1px solid green' }}
              value={30}>Thirty</option>
          </Select>
        </FormControl>

      </div>

【问题讨论】:

    标签: javascript html css reactjs material-ui


    【解决方案1】:

    我认为应该是:

    <Select
      style={{ width: 400, border: '1px solid red' }}
      ...
    />
    

    结果:

    【讨论】:

    猜你喜欢
    • 2020-04-28
    • 1970-01-01
    • 2021-09-17
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    • 2017-01-20
    • 2014-05-27
    • 2023-03-27
    相关资源
    最近更新 更多