From 3285dd30e6ca1fe85f55131875d7d4ce77bb540a Mon Sep 17 00:00:00 2001 From: git Date: Mon, 5 Feb 2018 11:32:42 +0900 Subject: [PATCH] add props.customAction --- src/FileUpload.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/FileUpload.vue b/src/FileUpload.vue index 492472e..ce652b0 100644 --- a/src/FileUpload.vue +++ b/src/FileUpload.vue @@ -93,6 +93,10 @@ export default { type: String, }, + customAction: { + type: Function, + }, + headers: { type: Object, default: Object, @@ -762,6 +766,10 @@ export default { return Promise.reject('size') } + if (this.customAction) { + return this.customAction(file, this) + } + if (this.features.html5) { if (this.shouldUseChunkUpload(file)) { return this.uploadChunk(file) @@ -769,11 +777,14 @@ export default { if (file.putAction) { return this.uploadPut(file) } - - return this.uploadHtml5(file) + if (file.postAction) { + return this.uploadHtml5(file) + } } - - return this.uploadHtml4(file) + if (file.postAction) { + return this.uploadHtml4(file) + } + return Promise.reject('No action configured') }, /**