Is there Select Field in Material UI version 1?

痴心易碎 提交于 2019-12-11 05:27:50

问题


I am new to Material UI and am trying to use V1. Is there Select Field in V1. I can't find it. Is it replaced by something else? Thanks


回答1:


As of material V1.2 :

import Select from '@material-ui/core/Select';

...

          <Select
            value={this.state.age}
            onChange={this.handleChange}
            inputProps={{
              name: 'age',
              id: 'age-simple',
            }}
          >
            <MenuItem value="">
              <em>None</em>
            </MenuItem>
            <MenuItem value={10}>Ten</MenuItem>
            <MenuItem value={20}>Twenty</MenuItem>
            <MenuItem value={30}>Thirty</MenuItem>
          </Select>



回答2:


The SelectField component in Material UI v1 is currently work in progress. You can see the current progress here.

I recently ported some projects to Material UI v1 and replaced select fields with radio buttons.

Edit Since v1.0.0-beta.9 the Selectcomponent is available. Example usage:

  <Select
    value={this.state.value}
    onChange={(e) => this.setState({ value : event.target.value}) }
    input={<Input name="select" id="select-simple" />}
  >
    <MenuItem value={0}>
      <em>None</em>
    </MenuItem>
    <MenuItem value={10}>Ten</MenuItem>
    <MenuItem value={20}>Twenty</MenuItem>
    <MenuItem value={30}>Thirty</MenuItem>
  </Select>


来源:https://stackoverflow.com/questions/45635558/is-there-select-field-in-material-ui-version-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!