element el-upload选择文件之前添加提示
<el-button type="primary" size="small" @click="importTips">
导入</el-button
>
<el-upload
:show-file-list="false"
action
ref="refUpload"
:on-change="handleImportFile"
:auto-upload="false"
>
</el-upload>
importTips() {
this.$confirm("确认导入?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
dangerouslyUseHTMLString: true,
type: "warning",
})
.then(() => {
this.$refs['refUpload'].$refs['upload-inner'].handleClick()
})
.catch(() => {});
},
handleImportFile(file) {
console.log(file)
let formdata = new FormData();
formdata.append("file", file.raw);
},