wx.saveFile下载后的文件不好找,在文件管理中下载的路径不清晰,需要进一步研究
文件保存成功,本地路径: wxfile://store_cb07513f44cf07e5f95c0aa0dc5ac436db75be82f5008acd045d479b398154d2.xlsx
使用wx.openDocument打开文件后,右上角三个点点击保存到手机
微信:文件已保存到 /sdcard/Download/WeiXin/tmp_dawhduadwadjaidzxncijdwa.xlsx
wx.downloadFile({
url: 'https://example.com/audio/123', //仅为示例,并非真实的资源
success (res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
wx.openDocument({
filePath: res.tempFilePath,
showMenu: true,
fileType: 'pdf',
success: function (res) {
console.log('打开文档成功')
},
fail: function (res) {
getApp().showToast("预览失败")
}
})
}
})
wx.downloadFile({
url: 'https://example.com/sample.pdf', // PDF 文件的 URL
success: function (res) {
// 下载成功后将文件保存到本地
wx.saveFile({
tempFilePath: res.tempFilePath, // 下载的文件临时路径
success: function (res) {
// 文件保存成功后,可以通过 res.savedFilePath 获取本地路径
console.log('文件保存成功,本地路径:', res.savedFilePath);
},
fail: function (res) {
console.log('文件保存失败:', res);
}
});
},
fail: function (res) {
console.log('文件下载失败:', res);
}
});
2、el-checkbox 如果赋值undefined,会有异常,显示上一次勾选或不勾选的值