import AutoImage from '@/components/auto-image'; import { CloseCircleOutlined } from '@ant-design/icons'; import { Spin } from 'antd'; import _ from 'lodash'; import React, { useCallback } from 'react'; import '../style/thumb-img.less'; const ThumbImg: React.FC<{ dataList: any[]; editable?: boolean; onDelete?: (uid: number) => void; loading?: boolean; style?: React.CSSProperties; }> = ({ dataList, editable, onDelete, loading, style }) => { const handleOnDelete = useCallback( (uid: number) => { onDelete?.(uid); }, [onDelete] ); if (_.isEmpty(dataList)) { return null; } return ( <> {
{_.map(dataList, (item: any) => { return ( {loading ? ( ) : ( )} {editable && ( handleOnDelete(item.uid)} > )} ); })}
} ); }; export default React.memo(ThumbImg);