<!– html 局部 –>
<el-upload
ref="uploadRef"
list-type="picture-card"
action='#'
:headers="myHeaders"
:limit="1"
:http-request="dragSubmit">
<i class="el-icon-plus"></i>
</el-upload>
//JS 局部
myHeaders:{Authorization: token}, // 图片接口申请头
// 自定义上传
dragSubmit(event) {
this.$nextTick(() => {let formData = new FormData();
formData.append("img", event.file);
request.post('/employee/emp_img/',formData)
.then(res => {//doSomething...})
});
},