<Upload
ref="upload"
:before-upload="handleUpload"//上传之前调用
:show-upload-list="false"
:on-success="uploadSuccess2"//上传成功调用
:on-error="uploadError"//上传失败调用
:format="['xlsx']"//制定上传文件格式
:max-size="2048"//最大 上传文件大小
:on-format-error="handleFormatError2"//文件格式错误调用
:data="{noValidateType:0}"
name='upload'
action="/api/achievement/add_Excel_Achieve">//请求的接口
<Button type="ghost" class="upload-btn" title="上传excel">批量导入数据</Button>
</Upload>
uploadSuccess2 (res, file) { //上传成功
this.$Message.info(res.msg);
if(res.code == 200){
this.excel_name = res.info.originalName;
}
}
uploadError(error, file) { //上传失败
this.$Message.info(error);
}
handleFormatError2 (file) {
this.$Message.info("文件格式不正确,请上传excel格式文件");
}
uploadError(error, file) {
this.$Message.info(error);
}