代码:
uni.downloadFile({
url: `${downloadUrl}${file.id}`,
filePath: wx.env.USER_DATA_PATH + '/' + file.name,
success: (res) => {
if (res.statusCode === 200 && res.filePath) {
wx.openDocument({
filePath: res.filePath,
fileType: res.fileType,
success: function (res) {
console.log('打开文档成功');
},
});
}
}
})