ant design 中的 Select 组件常规写法


1.代码

import { Select, Spin } from 'antd';
const Option = Select.Option;

<Select
  allowClear
  showSearch
  optionFilterProp="children"
  placeholder="请选择"
  style={{ width: 200 }}
  onChange={this.handleChange.bind(this)}
  onFocus={this.handleFocus.bind(this)}
  getPopupContainer={triggerNode => triggerNode.parentNode}
  notFoundContent={this.state.dataList.length == 0 ? <Spin size="small" /> : null}
  disabled={false}
>
  {
    (this.state.dataList || []).map((item,index)=>{
      return <Option key={index} value={item.code}>{item.name}</Option>
    })
  }
</Select>

.


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM