1、使用uniapp官网的api打开=>uni.openDocument
uni.openDocument({
filePath: res.tempFilePath,
fileType: "pdf",
success: () => console.log("打开PDF成功")
})
2、使用原生的方式,通过plus.io的方式打开
plus.runtime.openFile(
plus.io.convertLocalFileSystemURL(filePath),
{},
() => {},
(e) => {
uni.showToast({ title: '无法打开PDF,请安装阅读器', icon: 'none' });
}
);