页面:
<el-upload action="上传接口url地址" :http-request="uploadSectionFile" multiple accept=".xls,.xlsx" :limit="1" :show-file-list="false"
ref="upload">
<el-button type="primary">上传<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
vue:
uploadSectionFile(param){
const self = this;
//file就是当前添加的文件
var fileObj = param.file;
// FormData 对象
var form = new FormData();
// 文件对象,key是后台接受的参数名称
form.append("file", fileObj);
self.$http.post("上传url接口地址",form).then((res) => {
// 这里做上传后的操作
console.log(res);
if (res) {