mirror of https://github.com/ElemeFE/element
add progress hook function property (#1782)
parent
9f0774813f
commit
47c62e9fe0
|
@ -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-remove | hook function when files are removed | function(file, fileList) | — | —
|
||||||
on-success | hook function when uploaded successfully | function(response, 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-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) | — | —
|
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
|
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 | — | []
|
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 | — | []
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
| on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — |
|
| on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — |
|
||||||
| on-success | 可选参数, 文件上传成功时的钩子 | function(response, file, fileList) | — | — |
|
| on-success | 可选参数, 文件上传成功时的钩子 | function(response, file, fileList) | — | — |
|
||||||
| on-error | 可选参数, 文件上传失败时的钩子 | function(err, response, file) | — | — |
|
| on-error | 可选参数, 文件上传失败时的钩子 | function(err, response, file) | — | — |
|
||||||
|
| on-progress | 可选参数, 文件上传时的钩子 | function(event, file, fileList) | — | — |
|
||||||
| before-upload | 可选参数, 上传文件之前的钩子,参数为上传的文件,若返回 false 或者 Promise 则停止上传。 | function(file) | — | — |
|
| before-upload | 可选参数, 上传文件之前的钩子,参数为上传的文件,若返回 false 或者 Promise 则停止上传。 | function(file) | — | — |
|
||||||
| thumbnail-mode | 是否设置为图片模式,该模式下会显示图片缩略图 | boolean | — | false |
|
| 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 | — | [] |
|
| default-file-list | 默认已上传的文件列表, 例如: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}] | array | — | [] |
|
||||||
|
|
|
@ -62,6 +62,10 @@ export default {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: noop
|
default: noop
|
||||||
},
|
},
|
||||||
|
onProgress: {
|
||||||
|
type: Function,
|
||||||
|
default: noop
|
||||||
|
},
|
||||||
onError: {
|
onError: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: noop
|
default: noop
|
||||||
|
@ -120,6 +124,7 @@ export default {
|
||||||
},
|
},
|
||||||
handleProgress(ev, file) {
|
handleProgress(ev, file) {
|
||||||
var _file = this.getFile(file);
|
var _file = this.getFile(file);
|
||||||
|
this.onProgress(ev, _file, this.fileList);
|
||||||
_file.percentage = ev.percent || 0;
|
_file.percentage = ev.percent || 0;
|
||||||
},
|
},
|
||||||
handleSuccess(res, file) {
|
handleSuccess(res, file) {
|
||||||
|
|
Loading…
Reference in New Issue