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' + }) } }