From e2f3254e463013ebe34284394ec7a758f2f7c400 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 5 Dec 2025 12:16:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20base=20xtUpload=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/xtUpload.vue | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/components/xtUpload.vue b/components/xtUpload.vue index ef1e4c5..0b759cb 100644 --- a/components/xtUpload.vue +++ b/components/xtUpload.vue @@ -194,6 +194,35 @@ const preview = (item) => { current: currentIndex >= 0 ? currentIndex : 0, urls: urls, }) + } else if (item.type == 10) { + uni.downloadFile({ + url: item.url, + success: function (res) { + var filePath = res.tempFilePath; + uni.openDocument({ + filePath: filePath, + showMenu: true, + success: function (res) { + console.log('打开文档成功'); + } + }); + } + }); + } else if (item.type == 20) { + uni.showToast({ + title: "暂不支持预览该文件", + icon : 'none' + }) + } else if (item.type == 30) { + uni.showToast({ + title: "暂不支持预览该文件", + icon : 'none' + }) + } else { + uni.showToast({ + title: "暂不支持预览该文件", + icon : 'none' + }) } }