2025-10-22 14:43:42 +08:00
|
|
|
import { Image } from "antd";
|
|
|
|
|
import { getFileUrl } from "../../utils/index";
|
|
|
|
|
|
2025-10-28 15:16:58 +08:00
|
|
|
/**
|
|
|
|
|
* 在查看页面中图片预览组件
|
|
|
|
|
*/
|
2025-10-22 14:43:42 +08:00
|
|
|
const PreviewImg = (props) => {
|
|
|
|
|
const { files = [], fileUrlKey = "filePath" } = props;
|
2025-10-28 15:16:58 +08:00
|
|
|
|
2025-10-22 14:43:42 +08:00
|
|
|
const fileUrl = getFileUrl();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Image.PreviewGroup>
|
|
|
|
|
{
|
|
|
|
|
files.filter(Boolean).map((item, index) => (
|
|
|
|
|
<Image
|
|
|
|
|
key={item[fileUrlKey] || item}
|
|
|
|
|
src={item[fileUrlKey] ? fileUrl + item[fileUrlKey] : fileUrl + item}
|
|
|
|
|
style={{ marginLeft: index > 0 ? 10 : 0 }}
|
|
|
|
|
width={100}
|
|
|
|
|
height={100}
|
|
|
|
|
alt=""
|
|
|
|
|
/>
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
</Image.PreviewGroup>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default PreviewImg;
|