未验证 提交 513eb66d 编写于 作者: 花裤衩 提交者: GitHub

fix[UploadExcel]: add file type check (#878)

上级 62e1c851
......@@ -41,6 +41,11 @@ export default {
return
}
const rawFile = files[0] // only use files[0]
if (!this.isExcel(rawFile)) {
this.$message.error('Only supports upload .xlsx, .xls, .csv suffix files')
return false
}
this.upload(rawFile)
e.stopPropagation()
e.preventDefault()
......@@ -110,6 +115,9 @@ export default {
headers.push(hdr)
}
return headers
},
isExcel(file) {
return /\.(xlsx|xls|csv)$/.test(file.name)
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册