<div class="uploadexcel">
<label for="fileInput">
<span class="importBtn">导入</span>
<!-- <el-button type="primary">上传文件</el-button> -->
</label>
<input
v-show="false"
type="file"
id="fileInput"
@change="handleFileUpload"
accept=".xlsx"
name="file"
ref="file"
/>
</div>
//script
// 导入
const handleFileUpload = (e) => {
console.log('导入res', e);
// console.log('导入file', file);
let file = e.target.files;
let form = new FormData()
form.append('xlsFile', e.target.files[0])
console.log('99999-----', form.get("xlsFile"));
importZbk(form).then(res => {
console.log(res);
e.target.value = ' ' // 当导入的文件相同的时候会出现第二次无法导入的问题
})
}
|