<el-upload
class="upload-file"
ref="upload"
:limit="currentTableData.length"
:headers="upload.headers"
:action="upload.newurl"
:on-exceed="handleExceed"
:before-remove="beforeRemove"
:before-upload="handleFileBefore"
:auto-upload="false"
multiple
>
export default {
data() {
return {
upload: {
headers: { Authorization: "Bearer " + getToken() },
newurl:'',
url: process.env.VUE_APP_BASE_API + "/nfm/nfmfile/upload/",
relationid:null,
},
}
},
methods: {
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 ${this.currentTableData.length} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
},
handleFileBefore(file){
return new Promise((resolve, reject) => {
this.upload.newurl = this.upload.url + this.upload.relationid;
this.$nextTick(() => resolve());
});
},
}