const config = {
onUploadProgress: e => { // 显示上传进度
const percent = (e.loaded / e.total * 100) || 0
this.percent = parseInt(percent) // 转为整数
// (e.loaded / e.total * 100) | 0 // 单竖杠0也可以转为整数
},
}
const res = await this.$http.post(this.url, formData, config)
<el-progress :percentage="percent"/>