1
0

index.js 658 B

123456789101112131415161718192021222324
  1. import React from 'react';
  2. import './index.less';
  3. import { Dropdown, Menu } from 'antd';
  4. import Icon from '../Icon';
  5. function More(props) {
  6. const { menu = [], size = '', children, onClick } = props;
  7. return (
  8. <Dropdown
  9. overlay={
  10. <Menu onClick={key => onClick && onClick(key)}>
  11. {menu.map(item => {
  12. if (!item || !item.key) return null;
  13. return <Menu.Item key={item.key}>{item.label}</Menu.Item>;
  14. })}
  15. </Menu>
  16. }
  17. trigger={['click']}
  18. >
  19. <div className="more">{children || <Icon name={size ? `more-${size}` : 'more'} />}</div>
  20. </Dropdown>
  21. );
  22. }
  23. export default More;