element Upload 上传文件只能上传一次 ,再次点击上传无反应的问题的坑,clearFiles()也不起作用
<el-upload class="upload-btn ml10 mr10" ref="uploadfile"
action :limit="1" accept=".xls, .xlsx"
:show-file-list="false" :auto-upload="false"
:on-change="file => importTable(file, row)"
:file-list="fileList">
data() {
return {
fileList:[]
}
}
importTable(file,item) {
var data = new FormData();
data.append("file", file.raw);
data.append("activityId", item.activityId);
this.fileList = []//这里是重点,替换这个方法(this.$refs.uploadfile.clearFiles())
importUser(data).then(res => {
this.$message.success("文件导入成功");
this.getlist()//更新列表
})
},