浩之铭
浩之铭
  • 发布:2019-11-15 17:38
  • 更新:2019-11-25 13:51
  • 阅读:1167

【报Bug】 选择文件,下载进度监听无效

分类:uni-app

按照官方文档,写的下载监听,但是在downloadTask.onProgressUpdate中一直监听不到下载进度
代码如下:
const downloadTask=uni.downloadFile({
url:url,
success:function(res){
console.log(res);
if(res.statusCode==200){
var filePath = res.tempFilePath;
uni.openDocument({
filePath:filePath
})
}else{
uni.showToast({
title:"文档打开失败,请重试",
icon:"none"
})
}
},
fail:()=>{
uni.showToast({
title:"文档打开失败,请重试",
icon:"none"
})
},
complete:()=>{
that.showProgress=false;
}
});

 downloadTask.onProgressUpdate(function(res){  
                console.log(res);  //此处一直未进入,未打印。  
                that.progress=res.progress;  
            });  
2019-11-15 17:38 负责人:无 分享
已邀请:
浩之铭

浩之铭 (作者)

服务器返回的totalsize 为0的时候,监听进度无法生效。

该问题目前已经被锁定, 无法添加新回复