vue-resource 提交fromData 得到上传进度问题
本文介绍了vue-resource 提交fromData 得到上传进度问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
想要实现文件上传的进度条效果
当前代码:
UploadResource.save({
onprogress: progress => {
console.log(progress)
}
}, formData).then(response => {
if (response.json().status_code === 200) {
this.$broadcast('addOriginal', response.json().data)
}
})
官方文档里没发现有关于progress的具体用法,只有一句话描述
Parameter | Type | Description
progress | function(event) | Callback function to handle the ProgressEvent of uploads
只得自己摸索,不得要领,求会的大神指点
解决方案
this.$http.post(url,data,{progress:function(event){
console.log(event);
}
}).then((response)=>{}
这篇关于vue-resource 提交fromData 得到上传进度问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文