bootstrap-vue提交formData得到上传或下载的进度
代码实现
//获取上传进度
this.$http
.post(url,formData,{onUploadProgress:function(event){
console.log(event.loaded);//已经上传到后端附件的量
console.log(event.total);//需要上传到后端附件的总量
}})
.then(response => {
},
error => {
})
//获取下载进度
this.$http
.post(url,formData,{onDownloadProgress:function(event){
console.log(event.loaded);//已经下载到本地附件的量
console.log(event.total);//需要下载到本地附件的总量
}})
.then(response => {
},
error => {
})
注意
不管上传还是下载,获取到的是前端到后端的进度,至于后端到服务器的进度是无法获取到的