From 5cb9529900fca019eb93a3232c0b5c763b59e828 Mon Sep 17 00:00:00 2001 From: wjh Date: Fri, 27 Sep 2024 11:51:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=BB=E5=8A=A8=E7=AB=AF-=E6=A1=86?= =?UTF-8?q?=E6=9E=B6):=20=E9=99=84=E4=BB=B6=E5=88=A0=E9=99=A4(=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E6=8E=89)=20(#1574)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1574 Co-authored-by: wjh Co-committed-by: wjh --- .../components/antd-mobile/ImageUploader/ImageUploader.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/ImageUploader/ImageUploader.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/ImageUploader/ImageUploader.tsx index 7408da99a..4075de3a9 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/ImageUploader/ImageUploader.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/ImageUploader/ImageUploader.tsx @@ -7,6 +7,7 @@ import { ImageUploader, ImageUploadItem } from 'antd-mobile'; export const MImageUploader = connect( (props) => { const [fileList, setFileList] = useState([]); + const [change, setChange] = useState(false); const field = props.value || []; useEffect(() => { @@ -47,6 +48,11 @@ export const MImageUploader = connect( setChange(true); props.onChange(field); }} + onDelete={(file) => { + const fileIndex = field.findIndex((item) => item.id === file.key); + field.splice(fileIndex, 1); + props.onChange(field); + }} /> ); },