When adding the same file when uploading el-upload in elementUI, only one file is guaranteed.

what if the same file is added multiple times and only one file is displayed and only one file is uploaded in elementUI when el-upload uploads the same file?

Oct.28,2021

8.1k reading of this question, but there is no appropriate answer yet. Now to see this question to answer may be too late for the landlord, but still seriously code, hoping to be helpful to the follow-up people.
I know what the landlord means, because setting : auto-upload=false requires a hook for before-add to see if the file is duplicated before adding, but element-ui does not provide a hook for before-add. However, you can see how to solve this problem by looking at the source code of element-ui. The file in el-upload is packaged. If you want to add a file, file.status will be set to ready, and upload will be set to uploading,. Successful upload will be set to success, upload failure will be set to fail. The on-change hook is described as "the hook when the state of the file changes, and it will be called when the file is added, uploaded successfully and failed." you can see that "add file" is included here, but does not include "delete file", so you can do this: bind the on-change function and determine whether the incoming file.status is ready or not to determine whether to add a file. Because from the above description, we can see that "on-change discovers file.status='ready' " to "on-change is ready to add files" is at least a single shot.
the following code is attached:
vue template (is written in pug, saving the number of words):

changeUpload(file, fileList) {
   this.fileList = fileList.slice(-1)
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e62202-45976.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e62202-45976.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?