上传的标签是这样的写的。
<el-upload
class="upload-demo"
ref="uploadNewFile"
:action="actionUrl"
:file-list="fileList"
:auto-upload="false"
:on-change="newFileChange"
:on-remove="removeFile"
:data="newFileData"
name="files"
:on-preview="handlePreview">
<el-button type="primary" class="button b2 upload">
<i class="iconfont icon-shangchuan"></i> 上传
</el-button>
<el-input style="display: none" v-model="formData.newFile"></el-input>
</el-upload>
提交的时候
saveIt: function () {
this.$refs['newAddForm'].validate((valid) => {
if(valid){
if (this.fileNameCheckFlag) {
this.newFileData.dictionaryName = this.formData.fileName;
this.newFileData.indexName = this.formData.fileName;
this.newFileData.isPublish = false;
this.newFileData.menuId = 256;
this.$refs['newAddForm'].resetFields();
this.zDialog.showAdd = false;
this.$refs.uploadNewFile.submit();
}
}
但是上传文件提交的时候需要带上 this.newFileData.title(文件名),和 this.newFileData.sort(文件排序号);
请问上传多个文件的时候文件名和文件排序号怎么赋值? 在哪里赋值?
newFileChange函数里面获取文件并append title和sort
var file = document.querySelector('[type=file]');