// 参数一 url 二 参数 三 配置项
axios
.post(
'www.baidu.com',
{},
{
responseType: 'blob',
timeout: 300000,
onDownloadProgress(ProgressEvent) {
const load = ProgressEvent.loaded
const total = ProgressEvent.total
const progress = (load / total) * 100
console.log('progress=' + progress)
//一开始已经在计算了 这里要超过先前的计算才能继续往下
// if (progress > _this.fileDown.percentage) {
// _this.fileDown.percentage = Math.floor(progress)
// }
if (progress == 100) {
//下载完成
// _this.fileDown.loadDialogStatus = false
}
},
}
)
.then((res) => {})
axios下载文件进度显示
于 2023-04-07 10:22:25 首次发布