function loadfile(data){
let url = data.file_url
let fileName =data.title;
wx.showLoading({
title: '正在打开文件'
})
const manage = wx.getFileSystemManager();
wx.downloadFile({
url: url,
success (res) {
var savePath = wx.env.USER_DATA_PATH + "/" + fileName
if (res.statusCode == 200) {
manage.saveFile({
tempFilePath: res.tempFilePath,
filePath: savePath+'.docx',
success:function(res){
wx.openDocument({
filePath: res.savedFilePath,
success: function (res) {
wx.hideLoading()
}
})
}
})
}
}
})
}
微信小程序 下载文件到本地 (解决文件名乱码问题)
最新推荐文章于 2024-07-24 09:01:11 发布