feat: base xtUpload支持预览

This commit is contained in:
caoqianming 2025-12-05 12:16:42 +08:00
parent 965291e30c
commit e2f3254e46
1 changed files with 29 additions and 0 deletions

View File

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