|
|
@@ -197,40 +197,25 @@
|
|
|
* 文件类型的限制
|
|
|
*/
|
|
|
fileExtType() {
|
|
|
- const accept = this.accept
|
|
|
- const acceptTypes = this.acceptTypes
|
|
|
- const fileTypes = this.fileTypes
|
|
|
- let type = ''
|
|
|
let targetFileTypes = []
|
|
|
this.targetExt = false
|
|
|
- for (const i in acceptTypes) {
|
|
|
- if (acceptTypes[i] === accept) {
|
|
|
- type = i
|
|
|
- targetFileTypes = fileTypes[i]
|
|
|
- } else {
|
|
|
- if (accept === '*') {
|
|
|
- // 不限制
|
|
|
- targetFileTypes = '*'
|
|
|
- } else {
|
|
|
- // 自定义
|
|
|
- targetFileTypes = accept.split(',')
|
|
|
- }
|
|
|
- }
|
|
|
+ if (this.accept === '*') {
|
|
|
+ // 不限制
|
|
|
+ targetFileTypes = '*'
|
|
|
+ } else {
|
|
|
+ // 自定义
|
|
|
+ targetFileTypes = this.accept.split(',')
|
|
|
}
|
|
|
const fileList = this.multiple ? this.fileList : [this.fileList]
|
|
|
if (targetFileTypes !== '*') {
|
|
|
this.targetExt = fileList.every(i => {
|
|
|
- // console.log(targetFileTypes, `.${i.ext}`) // 控件类型集,过滤文件得后缀
|
|
|
- if (type === 'compress') {
|
|
|
- return targetFileTypes.includes(`${i.ext}`)
|
|
|
- } else {
|
|
|
- return targetFileTypes.includes(`${i.ext}`)
|
|
|
- }
|
|
|
+ // console.log(targetFileTypes, `.${i.ext}`)
|
|
|
+ return targetFileTypes.includes(`.${i.ext}`)
|
|
|
})
|
|
|
} else {
|
|
|
this.targetExt = true
|
|
|
}
|
|
|
- // console.log(fileList, this.targetExt, 'lll') // 已上传文件,过滤结果
|
|
|
+ // console.log(fileList, this.targetExt)
|
|
|
return this.targetExt
|
|
|
},
|
|
|
handleConfirm() {
|