ImageXXXC.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import './index.less';
  3. import Lazyimg from "react-lazyimg-component"
  4. import { Popover } from 'antd';
  5. import { TooltipPlacement } from 'antd/es/tooltip';
  6. interface Props {
  7. imageList: { imageUrl: string, imageId: number }[]
  8. style?: React.CSSProperties
  9. placement?: TooltipPlacement
  10. }
  11. /**
  12. * 多图
  13. * @param param0
  14. * @returns
  15. */
  16. const ImageXXXC: React.FC<Props> = ({ imageList, style, placement }) => {
  17. return (
  18. <Popover
  19. placement={placement || "right"}
  20. content={<div className='mediaPic mediaPicPopover'>
  21. <div className='mediaPic-imgList' style={[3, 6].includes(imageList.length) ? { width: '100%' } : {}}>
  22. {imageList.map((item, index) => <Lazyimg
  23. style={[3, 6, 9].includes(imageList.length) ? { width: 'calc(33.333% - 1px)' } : [4].includes(imageList.length) ? { width: 'calc(50% - 2px)' } : {}}
  24. key={item.imageId + '_' + index}
  25. animateType="transition"
  26. src={item.imageUrl}
  27. className={`lazy`}
  28. animateClassName={['transition-enter', 'transition-enter-active']}
  29. />)}
  30. </div>
  31. </div>}
  32. overlayClassName="mediaPicPopoverContent"
  33. >
  34. <div style={style} className='mediaPic mediaPic-C'>
  35. <div className='mediaPic-imgList' style={[1, 3, 4, 6].includes(imageList.length) ? { width: '100%' } : {}}>
  36. {imageList.map((item, index) => <Lazyimg
  37. style={[1].includes(imageList.length) ? { height: '100%' } : [3, 6, 9].includes(imageList.length) ? { width: 'calc(33.333% - 1px)' } : [4].includes(imageList.length) ? { width: 'calc(50% - 2px)' } : {}}
  38. key={item.imageId + '_' + index}
  39. animateType="transition"
  40. src={item.imageUrl}
  41. className={`lazy`}
  42. animateClassName={['transition-enter', 'transition-enter-active']}
  43. />)}
  44. </div>
  45. </div>
  46. </Popover>
  47. );
  48. };
  49. export default React.memo(ImageXXXC);