diff --git a/examples/docs/en-US/upload.md b/examples/docs/en-US/upload.md index e6d9d4752..507ba61b6 100644 --- a/examples/docs/en-US/upload.md +++ b/examples/docs/en-US/upload.md @@ -161,6 +161,7 @@ on-preview | hook function when clicking the uploaded files | function(file) | on-remove | hook function when files are removed | function(file, fileList) | — | — on-success | hook function when uploaded successfully | function(response, file, fileList) | — | — on-error | hook function when some errors occurs | function(err, response, file) | — | — +on-progress | hook function when some progress occurs | function(event, file, fileList) | — | — | before-upload | hook function before uploading with the file to be uploaded as its parameter. If `false` or a `Promise` is returned, uploading will be aborted | function(file) | — | — thumbnail-mode | whether thumbnail is displayed | boolean | — | false default-file-list | default uploaded files, i.e: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}] | array | — | [] diff --git a/examples/docs/zh-CN/upload.md b/examples/docs/zh-CN/upload.md index 643922443..9f24dc462 100644 --- a/examples/docs/zh-CN/upload.md +++ b/examples/docs/zh-CN/upload.md @@ -172,6 +172,7 @@ | on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — | | on-success | 可选参数, 文件上传成功时的钩子 | function(response, file, fileList) | — | — | | on-error | 可选参数, 文件上传失败时的钩子 | function(err, response, file) | — | — | +| on-progress | 可选参数, 文件上传时的钩子 | function(event, file, fileList) | — | — | | before-upload | 可选参数, 上传文件之前的钩子,参数为上传的文件,若返回 false 或者 Promise 则停止上传。 | function(file) | — | — | | thumbnail-mode | 是否设置为图片模式,该模式下会显示图片缩略图 | boolean | — | false | | default-file-list | 默认已上传的文件列表, 例如: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}] | array | — | [] | diff --git a/packages/upload/src/index.vue b/packages/upload/src/index.vue index 5ed41767c..33bf5ab69 100644 --- a/packages/upload/src/index.vue +++ b/packages/upload/src/index.vue @@ -62,6 +62,10 @@ export default { type: Function, default: noop }, + onProgress: { + type: Function, + default: noop + }, onError: { type: Function, default: noop @@ -120,6 +124,7 @@ export default { }, handleProgress(ev, file) { var _file = this.getFile(file); + this.onProgress(ev, _file, this.fileList); _file.percentage = ev.percent || 0; }, handleSuccess(res, file) {