From 8523865056de4335db1c15f104b5dd4f5453f507 Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Mon, 20 Mar 2017 11:34:12 +0800 Subject: [PATCH] fix file not remote when before-upload reject --- packages/upload/src/index.vue | 7 +++++-- packages/upload/src/upload.vue | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/upload/src/index.vue b/packages/upload/src/index.vue index 6c343b790..e29927e74 100644 --- a/packages/upload/src/index.vue +++ b/packages/upload/src/index.vue @@ -160,7 +160,10 @@ export default { this.onError(err, file, this.uploadFiles); this.onChange(file, this.uploadFiles); }, - handleRemove(file) { + handleRemove(file, raw) { + if (raw) { + file = this.getFile(raw); + } var fileList = this.uploadFiles; fileList.splice(fileList.indexOf(file), 1); this.onRemove(file, fileList); @@ -181,7 +184,7 @@ export default { this.uploadFiles .filter(file => file.status === 'ready') .forEach(file => { - this.$refs['upload-inner'].upload(file.raw, file); + this.$refs['upload-inner'].upload(file.raw); }); }, getMigratingConfig() { diff --git a/packages/upload/src/upload.vue b/packages/upload/src/upload.vue index 3ac630302..223ac34e9 100644 --- a/packages/upload/src/upload.vue +++ b/packages/upload/src/upload.vue @@ -85,12 +85,12 @@ export default { this.post(rawFile); } }, () => { - if (file) this.onRemove(file); + this.onRemove(rawFile, true); }); } else if (before !== false) { this.post(rawFile); } else { - if (file) this.onRemove(file); + this.onRemove(rawFile, true); } }, post(rawFile) {