小编San*_*aHE的帖子

修复 react-select 下拉列表的高度(React Material UI)

我已经使用 react-select 实现了下拉列表,其中显示了预先输入的选项,但最初下拉列表很大并且占据了整个页面。我想知道如何将 react-select 下拉列表的样式设置为固定高度,并在溢出时提供滚动。 反应选择

以下是我的部分代码

class Project extends React.Component {
  render() {
    const selectStyles = {
      input: base => ({
        ...base,
        color: theme.palette.text.primary,
        '& input': {
          font: 'inherit',
        },
      })
    };
    return ( <
      SelectN inputProps = {
        {
          name: 'headedByUserId',
          id: 'headedByUserId',
        }
      }
      classes = {
        classes
      }
      styles = {
        selectStyles
      }
      options = {
        suggestions
      }
      components = {
        components
      }
      value = {
        this.state.fields["headedByUserId"]
      }
      onChange = {
        this.handleChangeDropdown.bind(this, "headedByUserId")
      }
      placeholder = …
Run Code Online (Sandbox Code Playgroud)

css reactjs react-material

1
推荐指数
1
解决办法
4723
查看次数

标签 统计

css ×1

react-material ×1

reactjs ×1