feat: base xtUpload支持预览
This commit is contained in:
parent
965291e30c
commit
e2f3254e46
|
|
@ -194,6 +194,35 @@ const preview = (item) => {
|
||||||
current: currentIndex >= 0 ? currentIndex : 0,
|
current: currentIndex >= 0 ? currentIndex : 0,
|
||||||
urls: urls,
|
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'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue