admin管理员组文章数量:1605301
当代码执行结束后将会打开下载已完成的文件
excel() {
const downloadTask = uni.downloadFile({
url: 'https://kaima.site:9988/uploads-mall/uploads/11111.xlsx',
success: function(res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
console.log('打开文档成功');
}
});
}
});
downloadTask.onProgressUpdate((res) => {
console.log('下载进度' + res.progress);
console.log('已经下载的数据长度' + res.totalBytesWritten);
console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
});
// const downloadTask = uni.downloadFile({
// url: 'http://imgbian/file/2019/0414/7bee7eef5fc44417a0b02a46576e7e16.jpg', //仅为示例,并非真实的资源
// success: (res) => {
// if (res.statusCode === 200) {
// console.log('下载成功');
// this.dd = res.tempFilePath;
// console.log(this.dd);
// console.log('123456789');
// // let filePath =null;
// // filePath = res.tempFilePath;
// // console.log(filePath)
// uni.saveFile({
// filePath:res.tempFilePath,
// complete(res) {
// console.log(res)
// }
// });
// }
// }
// });
// downloadTask.onProgressUpdate((res) => {
// console.log('下载进度' + res.progress);
// console.log('已经下载的数据长度' + res.totalBytesWritten);
// console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
// });
}
版权声明:本文标题:小程序,uniapp 实现excel,pdf,word导出并分享 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1728480996a1160102.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论