1. import React from 'react';
    2. import { array, string } from 'prop-types';
    3. import { Tooltip, List, Badge } from 'antd';
    4. import { InfoCircleOutlined } from '@ant-design/icons';
    5. const { Item } = List;
    6. const style = { paddingTop: 4, paddingBottom: 4}
    7. TooltipList.propTypes = {
    8. data: array.isRequired,
    9. title: string
    10. };
    11. function TooltipList(props) {
    12. const { data = [], title = '' } = props;
    13. return (
    14. <Tooltip
    15. title={
    16. <List
    17. header={`${title}说明:`}
    18. dataSource={data}
    19. size="small"
    20. className="tips-title"
    21. split={false}
    22. renderItem={item => (
    23. <Item style={style}>
    24. <Badge color="#fff" />
    25. {item}
    26. </Item>
    27. )}
    28. />
    29. }
    30. >
    31. <InfoCircleOutlined />
    32. </Tooltip>
    33. );
    34. }
    35. export default React.memo(TooltipList);