index.js 732 B

123456789101112131415161718192021222324252627
  1. import React, { Component } from 'react';
  2. import { Select as ASelect } from 'antd';
  3. import './index.less';
  4. export default class Multiple extends Component {
  5. render() {
  6. const { select = [] } = this.props;
  7. return (
  8. <ASelect className="select-layout" mode="multiple" {...this.props}>
  9. {select.map((i, index) => {
  10. if (typeof i === 'string') {
  11. return (
  12. <ASelect.Option key={index} value={i}>
  13. {i}
  14. </ASelect.Option>
  15. );
  16. }
  17. return (
  18. <ASelect.Option key={index} value={i.value}>
  19. {i.name || i.title || i.label}
  20. </ASelect.Option>
  21. );
  22. })}
  23. </ASelect>
  24. );
  25. }
  26. }