<el-upload
accept=".doc,.pdf"
ref="upload"
:show-file-list="true"
:action="void"
:http-request="upLoadOnSelf"
:on-progress="uploadOnProgress"
:fileList="flieList">
<el-button type="primary">點擊上傳</el-button>
</el-upload>
</div>
然后method里面的方法 upLoadOnSelf(fileParam){ const fileObj =fileParam.file; const form = new FormData(); form.append("file", fileObj); this.$http.post(`/file/upload`, form, {onUploadprogress:function(event){ percent = event.loaded/event.total*100 fileParam.onProgress({percent:percent }) } }).then(res={//處理成功情況 fileParam.onSuccess()//顯示完成按鈕小圖標 ...//其它處理 }) }, uploadOnProgress(event,file,fileList){ this.progress=event.perecent //調用默認的進度條 }