From c329559c7aac6fb99d785e7b451ff52521c7fa17 Mon Sep 17 00:00:00 2001 From: edram Date: Thu, 6 Nov 2025 15:09:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20onPreviewFile=20?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=A2=84=E8=A7=88=E7=BA=BF=E4=B8=8A=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vantui/src/uploader/index.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/vantui/src/uploader/index.tsx b/packages/vantui/src/uploader/index.tsx index 4cd34b36..62d490d7 100644 --- a/packages/vantui/src/uploader/index.tsx +++ b/packages/vantui/src/uploader/index.tsx @@ -1,4 +1,5 @@ import { + downloadFile, previewImage as TaroPreviewImage, showToast, openDocument, @@ -244,10 +245,18 @@ export function Uploader(props: UploaderProps) { } }, [previewFullImage, state.lists]) const onPreviewFile = useCallback( - (event: ITouchEvent) => { + async (event: ITouchEvent) => { const { index } = event.currentTarget.dataset + let filePath = state.lists[index].url + if (filePath.startsWith('http')) { + const temp = await downloadFile({ + url: state.lists[index].url, + }) + filePath = temp.tempFilePath + } + openDocument({ - filePath: state.lists[index].url, + filePath: filePath, showMenu: true, }) },