Skip to content

The upload component settings showUploadList = "true", returns false in the function beforeUpload, but the file continues to upload #2489

@summsnow

Description

@summsnow
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

undefined

Environment

"vue": "^2.6.10", Google Chrome版本 81.0.4044.138(正式版本) (64 位)

Reproduction link

https://www.antdv.com/components/upload-cn/

Steps to reproduce

<a-upload
name="avatar"
list-type="text"
:multiple="false"
:default-file-list="fileList"
:before-upload="beforeUploadManual"
@change="handleChangeManual"

导入文档

beforeUploadManual(file) {
const fileType = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' || file.type === 'application/msword'
if (!fileType) {
this.$message.error('只能上传word文档')
}
const fileNum = this.fileList.length
if (fileNum > 0) {
this.fileList.splice(fileNum - 1, 1)
}
return fileType
},

Prompt "only word document can be uploaded", but the selected file is still uploaded to the page

What is expected?

After the beforeupload function returns false, the file will not be uploaded to the page

What is actually happening?

After the beforeupload function returns false, the file will be uploaded to the page

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions