let url = res.data.fileUrl
if(that.systemInfo.platform =='windows'){
uni.downloadFile({
url: url,
filePath: `wxfile://temp/list.xlsx`,
success: function (res) {
that.tempUrl = res.tempFilePath
var filePath = res.tempFilePath;
wx.saveFileToDisk({
filePath: filePath,
success: function (res) {
that.$toast('保存成功')
}
})
}
});
}else {
uni.downloadFile({
url: url,
success: function (res) {
that.tempUrl = res.tempFilePath
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu:true,
success: function (res) {
// console.log('打开文档成功');
}
});
}
});
}
小程序下载文件
最新推荐文章于 2024-08-02 00:07:06 发布