diff --git a/src/components/ImageUploader.jsx b/src/components/ImageUploader.jsx index 2254a71..251f5a2 100644 --- a/src/components/ImageUploader.jsx +++ b/src/components/ImageUploader.jsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { Upload, List, Popconfirm } from "antd"; -import { UploadOutlined } from "@ant-design/icons"; +import { UploadOutlined, DeleteOutlined } from "@ant-design/icons"; import { Image } from "antd"; import { fetchJSON } from "@/utils/request"; import { HT3_HOST } from "@/config"; @@ -166,31 +166,39 @@ export const ImageUploader = props => { setPreviewOpen(true); }; - const handleRemove = file => { - - return ( - handleDelete(file)} - onCancel={() => setFileList([...fileList])} - okText="Yes" - cancelText="No" - > - - - ); - // 返回 false 阻止默认的删除行为,让 Popconfirm 来处理 + const handleRemove = () => { return false; }; - const itemRender = (originNode, file, fileList, actions) => { - - }; - return ( <> - + { + return ( + { + handleDelete(file); + }} + onCancel={() => setFileList([...fileList])} + okText="是" + cancelText="否"> + + + ); + }, + }}> 上传图片 @@ -252,4 +260,4 @@ export const ImageViewer = props => { ); }; -export default ImageUploader; \ No newline at end of file +export default ImageUploader;