[Bug Report] The event "before-upload" in el-uploader is not really before upload, and we need a before-remove event.
Element UI version
2.0.8
OS/Browsers version
all
Vue version
2.5.13
Reproduction Link
https://jsfiddle.net/niboac/x9xk4zws/1/
Steps to reproduce
upload a image bigger then 1Kb
What is Expected?
Do not call on-remove event
What is actually happening?
called on-remove event
` upload(rawFile, file) {
this.$refs.input.value = null;
if (!this.beforeUpload) {
return this.post(rawFile);
}
const before = this.beforeUpload(rawFile);
if (before && before.then) {
before.then(processedFile => {
const fileType = Object.prototype.toString.call(processedFile);
if (fileType === '[object File]' || fileType === '[object Blob]') {
this.post(processedFile);
} else {
this.post(rawFile);
}
}, () => {
this.onRemove(null, rawFile);
});
} else if (before !== false) {
this.post(rawFile);
} else {
this.onRemove(null, rawFile);
}
}`
其实上传时的那个on-remove什么也没做,只是简单的回调函数吧~
很奇怪
为什么要调那个onRemove?没理由。
It tries to remove the file even before-upload comes with false.
This is an issue.
TO give a better feedback, because I think this is a mayor issue.
I upload an image with not a valid extension, thus this, beforeUpload should not be called. But it does get called, I must do:
beforeRemove(file, fileList) {
if (false === this.beforeAvatarUpload(file)) {
return;
}
...
and also
handleRemove(file, fileList) {
if (false === this.beforeAvatarUpload(file)) {
return;
}
.....
-So, seems before upload only works partial.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.