axios upload excel file
axios upload excel file
https://github.com/axios/axios/issues/1660
https://stackoverflow.com/questions/52521274/use-axios-to-get-and-save-an-excel-file
https://serversideup.net/uploading-files-vuejs-axios/
https://www.pluralsight.com/guides/asynchronous-file-upload-react
post formData
axios.post( '/single-file', formData, {
headers: {
'Content-Type': 'multipart/form-data'
},
},
).then(function(){
console.log('SUCCESS!!');
})
.catch(function(){
console.log('FAILURE!!');
});
upload component
https://zzk.cnblogs.com/my/s/blogpost-p?Keywords=upload+excel
postUploadExcel(blob) {
const {
name,
type,
size,
lastModified,
lastModifiedDate,
webkitRelativePath,
} = blob;
// const types = [".xlsx", ".xls", ".csv"];
const types = ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
const littleSize = Math.ceil(size / 1000) <= 500 ? true : false;
const supportType = types.includes(type) ? true : false;
const seatMapTemplateId = this.templateId;
if (supportType) {
this.isShowWarning = false;
const formData = new FormData();
formData.append('file', blob);
// 不需要 Content-Type, new FormData(), 已经自带了 `multipart/form-data`
fetch(`/opapi/v2/seatMap/template/${seatMapTemplateId}/seatData`, {
method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
// mode: 'cors',// no-cors
// credentials: 'include',
body: formData,
})
.then(res => res.json())
.then(data => {
const {
data: url,
success,
errorHint,
errorCode,
} = data;
if(success) {
this.$message({
message: '上传成功',
type: 'success'
});
this.updateURL(url || ``);
} else {
this.$message({
message: `上传错误: ${errorCode}_${errorHint}`,
type: 'error'
});
}
})
.catch(error => {
this.$message({
message: '上传错误',
type: 'error'
});
console.error(error);
});
} else {
this.isShowWarning = true;
this.$message({
type: 'info',
message: '上传失败,请检查文件大小和类型!'
});
}
},
https://element.eleme.io/#/zh-CN/component/upload
refs
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
axios upload excel file的更多相关文章
- input support upload excel only
input support upload excel only demo https://codepen.io/xgqfrms/pen/vYONpLB <!-- <input placeh ...
- NetSuite SuiteScript 2.0 export data to Excel file(xls)
In NetSuite SuiteScript, We usually do/implement export data to CSV, that's straight forward: Collec ...
- Read Excel file from C#
Common way is: var fileName = string.Format("{0}\\fileNameHere", Directory.GetCurrentDirec ...
- csharp:using OpenXml SDK 2.0 and ClosedXML read excel file
https://openxmlexporttoexcel.codeplex.com/ http://referencesource.microsoft.com/ 引用: using System; u ...
- Creating Excel File in Oracle Forms
Below is the example to create an excel file in Oracle Forms.Pass the Sql query string to the below ...
- Formatting Excel File Using Ole2 In Oracle Forms
Below is the some useful commands of Ole2 to format excel file in Oracle Forms.-- Change font size a ...
- Read / Write Excel file in Java using Apache POI
Read / Write Excel file in Java using Apache POI 2014-04-18 BY DINESH LEAVE A COMMENT About a year o ...
- How to upload a file in MVC4
Uploading a file in Asp.Net MVC application is very easy. The posted file is automatically available ...
- The 13th tip of DB Query Analyzer, powerful processing EXCEL file
The 13thtip of DB Query Analyzer, powerful processing EXCEL file MA Genfeng (Guangdong UnitollServic ...
随机推荐
- cookie,session,token傻傻分不清
什么是认证(Authentication) • 通俗地讲就是验证当前用户的身份,证明"你是你自己"(比如:你每天上下班打卡,都需要通过指纹打卡,当你的指纹和系统里录入的指纹相匹配时 ...
- 聊一聊Axios与登录机制
前言 因为HTTP是一个stateless的协议,服务器并不会保存任何关于状态数据. 所以需要登录功能让服务器在以后请求的过程中能够识别到你的身份,而不是每次发请求都要输入用户名和密码. 下面介绍一下 ...
- JasperReports 取消自动分页/忽略分页
因为需要将合同比价单由PDF文档形式改为HTML页面方式,虽然转换文档类型了,但是发现HTML页面中间到了一定行数就出现了空行把Detail给隔开了.之前总想着怎样消除中间空行,以为是报表top页面边 ...
- Eclipse+Maven+Spring
1.首先按照how2j教程搭建Maven项目:http://how2j.cn/k/maven/maven-eclipse-maven-project/1332.html 2. 刚建好时没有资源文件夹的 ...
- requestAnimationFrame小结
背景 在Web应用中,实现动画效果的方法比较多,Javascript 中可以通过定时器 setTimeout或者setInterval 来实现,css3 可以使用 transition 和 anima ...
- Tomcat 核心组件 Connector
Connector是Tomcat的连接器,其主要任务是负责处理浏览器发送过来的请求,并创建一个Request和Response的对象用于和浏览器交换数据,然后产生一个线程用于处理请求,Connecto ...
- IP路由__IP路由选择过程
1.主机A上的某个用户ping主机B的IP地址 1.主机A的因特网控制报文协议(ICMP)将创建一个回应请求数据包(在它的数据域中只包含有字母). 2. ICMP将把这个有效负荷交给因特网协议(IP) ...
- UI自动化实战进阶PO设计模式
前言 经过前面的实战我们已经编写了几个测试用例,下面我们要用PO设计模式来调整我们的代码,让页面元素和测试业务进行分离,这样看起来直观而且后期的维护也方便. python有一个第三方的PO设计的库,既 ...
- c++中几种swap
在c与c++中,有多种办法可以通过函数交换传入的两数的值,但有容易有一些问题产生,因而本文将几种交换方式及容易出错的点进行了分类. 1.传引用这是c++中最常见方式如下: int swap1 (int ...
- 【uva 10600】ACM Contest and Blackout(图论--次小生成树 模版题)
题意:有T组数据,N个点,M条边,每条边有一定的花费.问最小生成树和次小生成树的权值. 解法:具体请见 关于生成树的拓展 {附[转]最小瓶颈路与次小生成树}(图论--生成树) 1 #include&l ...