mirror of https://github.com/ElemeFE/element
parent
126331c328
commit
249f04d57e
|
@ -353,7 +353,6 @@ with-credentials | whether cookies are sent | boolean | — |false
|
|||
show-upload-list | whether to show the uploaded file list | boolean | — | true
|
||||
type | type of Upload | string | select/drag | select
|
||||
accept | accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode` is `true` | string | — | —
|
||||
on-ajax | Optional parameters, the file when the server sends the hook, you can use the custom sdk [oss / bos] upload to the server to return data | function(optionts) | — | —
|
||||
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) | — | —
|
||||
|
|
|
@ -403,7 +403,6 @@
|
|||
| show-file-list | 是否显示已上传文件列表 | boolean | — | true |
|
||||
| type | 上传控件类型 | string | select,drag | select |
|
||||
| accept | 可选参数, 接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept)(thumbnail-mode 模式下此参数无效)| string | — | — |
|
||||
| on-ajax | 可选参数, 文件发送服务器时的钩子, 可以通过 使用自定义sdk[oss/bos] 上传到服务端返回数据 | function(optionts) | — | — |
|
||||
| on-preview | 可选参数, 点击已上传的文件链接时的钩子, 可以通过 file.response 拿到服务端返回数据 | function(file) | — | — |
|
||||
| on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — |
|
||||
| on-success | 可选参数, 文件上传成功时的钩子 | function(response, file, fileList) | — | — |
|
||||
|
|
|
@ -48,7 +48,6 @@ export default {
|
|||
type: String,
|
||||
default: 'select'
|
||||
},
|
||||
onAjax: Function,
|
||||
beforeUpload: Function,
|
||||
onRemove: {
|
||||
type: Function,
|
||||
|
@ -224,7 +223,6 @@ export default {
|
|||
fileList: this.uploadFiles,
|
||||
autoUpload: this.autoUpload,
|
||||
listType: this.listType,
|
||||
'on-ajax': this.onAjax,
|
||||
'on-start': this.handleStart,
|
||||
'on-progress': this.handleProgress,
|
||||
'on-success': this.handleSuccess,
|
||||
|
|
|
@ -27,10 +27,6 @@ export default {
|
|||
onError: Function,
|
||||
beforeUpload: Function,
|
||||
drag: Boolean,
|
||||
onAjax: {
|
||||
type: Function,
|
||||
default: ajax
|
||||
},
|
||||
onPreview: {
|
||||
type: Function,
|
||||
default: function() {}
|
||||
|
@ -97,7 +93,7 @@ export default {
|
|||
}
|
||||
},
|
||||
post(rawFile) {
|
||||
const options = {
|
||||
ajax({
|
||||
headers: this.headers,
|
||||
withCredentials: this.withCredentials,
|
||||
file: rawFile,
|
||||
|
@ -113,12 +109,7 @@ export default {
|
|||
onError: err => {
|
||||
this.onError(err, rawFile);
|
||||
}
|
||||
};
|
||||
const ajaxPromise = this.onAjax(options);
|
||||
/* global Promise:true */
|
||||
if (typeof Promise !== 'undefined' && ajaxPromise instanceof Promise) {
|
||||
ajaxPromise.then(options.onSuccess, options.onError);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleClick() {
|
||||
this.$refs.input.click();
|
||||
|
|
Loading…
Reference in New Issue