动态中的el-upload 中的自定义方法
如何判断是在哪个组件点击的它
"附件信息" prop="file">
"upload-demo"
ref="upload"
multiple
:accept="accept"
action=""
:with-credentials="true"
:http-request="httpRequest"
:file-list="fileList"
:auto-upload="false">
"trigger" size="small" type="primary">选取文件
"tip" class="el-upload__tip" style="display: inline-block;margin-left: 20px">
它们都是共用了一个方法httpRequest
在提交表单的时候同时上传文件
let arr = this.editableTabs;
for (let i = 0; i this.$refs['upload'][i].submit();//这里自定义调用上传文件
}
let url = process.env.VUE_APP_BASE_API + '/job/create/commit/'
let config = {
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + getToken()
}
}
this.$axios.post(url, this.fd, config).then(res => {...
问题一 现在只是触发了一次并且俩个tab的上传的文件合在一起上传了
可能是这里方法不对
原本应该实现的是每一个tab的每一个附件上传文件后 在表单提交的时候同时调用 应该是调用两次
this.$refs['upload'][i].submit();//这里自定义调用上传文件
问题二 每次的参数不一样
type:'tab1',
file:’上传的文件'
type:'tab2',
file:’上传的文件'
应该问题出现在这里
httpRequest(param) {
this.fd.append('file',param.file)
},
但是httpRequest是共用的一个方法 而且好像还传不了其它参数