Skip to content

文件格式错误时候打印文件属性,方便调试 #146

@zhn4

Description

@zhn4

Is your feature request related to a problem? Please describe.
业务使用 upload-to-ali 上传 ios 的 P12 证书以及 mobileprovision 描述文件,遇到设置 accept 的问题,accept = ‘application/*’ 不能解决文件类型问题。需要自己另外写 js 解析文件类型,有点麻烦

Describe the solution you'd like
在源码内判断文件类型的函数内加入一个 console 打印 files 方便开发者知道罕见文件的类型

if (
        this.accept &&
        (this.accept.indexOf('/*') > -1
          ? files.some(
              i => i.type.indexOf(this.accept.match(mimeTypeHalfRegex)) === -1
            )
          : files.some(i => this.accept.indexOf(i.type) === -1))
      ) {
        console.log(files) // 这里
        alert('文件格式有误!')
        reset()
        return
      }

最终效果
WechatIMG262.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions