my_upload(uploader) {
let form = new FormData();
form.append('file',uploader.file);
axios({
method:'post',
headers: {
"Content-Type": "multipart/form-data"
},
url:this.action_url,//自定义上传url
data:form,
onUploadProgress: progressEvent => {
let percent=(progressEvent.loaded / progressEvent.total * 100) | 0
uploader.onProgress({percent:percent});//调用uploader的进度回调
}
}).then((res)=>{
if(res.data.code==1){
this.$message.success('上传完成');
}else{
this.$message.error('上传失败');
}
}).catch((err)=>{
this.$message.error(err);
})
},
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)