We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62e1c85 commit 513eb66Copy full SHA for 513eb66
src/components/UploadExcel/index.vue
@@ -41,6 +41,11 @@ export default {
41
return
42
}
43
const rawFile = files[0] // only use files[0]
44
+
45
+ if (!this.isExcel(rawFile)) {
46
+ this.$message.error('Only supports upload .xlsx, .xls, .csv suffix files')
47
+ return false
48
+ }
49
this.upload(rawFile)
50
e.stopPropagation()
51
e.preventDefault()
@@ -110,6 +115,9 @@ export default {
110
115
headers.push(hdr)
111
116
112
117
return headers
118
+ },
119
+ isExcel(file) {
120
+ return /\.(xlsx|xls|csv)$/.test(file.name)
113
121
114
122
123
0 commit comments