新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。
uni.downloadFile({
url: 'https://xxxxxxxxxxxxxxxxxxxxxxxxxx.pdf',
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功');
}
});
}
});