Vue 使用 el-upload 上传文件并且提交额外参数
直接上代码吧
<el-upload style="display: inline-block;margin-right: 10px;" class="upload-demo" :action="`${baseUrl}/planFile/getExcelFile`" :auto-upload="true" :headers="{token: $cookie.get('token')}" :show-file-list="false" :file-list="fileList" :data={gnbId:scope.row.gnbId}>
<el-button :disabled="loading" size="small" type="text" icon="el-icon-upload2">上传文件</el-button>
</el-upload>
主要就是 :data 参数。