<el-upload
class="upload-demo"
ref="fileExcel"
action="/"
accept=".xlsx, .xls"
:before-upload="beforeUpload"
>
<el-button type="primary">导入</el-button>
</el-upload>
beforeUpload(file) {
console.log('file',file)
let formData = new FormData()
formData.append('file', file)
this.$confirm('确认导入吗?', '提示', { type: 'warning' })
.then(() => {
TextItemImport(formData).then(res => {
if (res.success === true) {
this.$message({ type: 'success', message: '导入成功!' })
this.getDataList()
} else {
this.$message({ type: 'error', message: res.errormsg })
}
})
})
.catch(err => {})
},