forked from ElemeFE/element
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
461e5ed
commit 4c58203
Showing
8 changed files
with
177 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import UploadDragger from '../upload/src/upload-dragger'; | ||
|
||
/* istanbul ignore next */ | ||
UploadDragger.install = function(Vue) { | ||
Vue.component(UploadDragger.name, UploadDragger); | ||
}; | ||
|
||
export default UploadDragger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Upload from './src'; | ||
import UploadDragger from './src/upload-dragger'; | ||
|
||
/* istanbul ignore next */ | ||
Upload.install = function(Vue) { | ||
Vue.component(Upload.name, Upload); | ||
Vue.component(UploadDragger.name, UploadDragger); | ||
}; | ||
|
||
export default { Upload, UploadDragger }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<script> | ||
import index from '.'; | ||
import Upload from './upload'; | ||
import IframeUpload from './iframe-upload'; | ||
import UploadList from './upload-list'; | ||
export default { | ||
name: 'ElUploadDragger', | ||
extends: index, | ||
components: { | ||
UploadList, | ||
Upload, | ||
IframeUpload | ||
}, | ||
props: { | ||
draggable: { | ||
type: Boolean, | ||
default: true | ||
} | ||
}, | ||
render(h) { | ||
var uploadList; | ||
if (this.showUploadList && !this.thumbnailMode && this.uploadFiles.length) { | ||
uploadList = ( | ||
<UploadList | ||
files={this.uploadFiles} | ||
on-remove={this.handleRemove} | ||
on-preview={this.handlePreview}> | ||
</UploadList> | ||
); | ||
} | ||
var props = { | ||
props: { | ||
type: this.type, | ||
draggable: this.draggable, | ||
action: this.action, | ||
multiple: this.multiple, | ||
'before-upload': this.beforeUpload, | ||
'with-credentials': this.withCredentials, | ||
headers: this.headers, | ||
name: this.name, | ||
data: this.data, | ||
accept: this.thumbnailMode ? 'image/gif, image/png, image/jpeg, image/bmp, image/webp' : this.accept, | ||
'on-start': this.handleStart, | ||
'on-progress': this.handleProgress, | ||
'on-success': this.handleSuccess, | ||
'on-error': this.handleError, | ||
'on-preview': this.handlePreview, | ||
'on-remove': this.handleRemove | ||
}, | ||
ref: 'upload-inner' | ||
}; | ||
var uploadComponent = (typeof FormData !== 'undefined' || this.$isServer) | ||
? <upload {...props}>{this.$slots.default}</upload> | ||
: <iframeUpload {...props}>{this.$slots.default}</iframeUpload>; | ||
return ( | ||
<div | ||
class={{ | ||
'el-upload-dragger': true, | ||
'is-dragOver': this.dragOver | ||
}} | ||
> | ||
{uploadComponent} | ||
{this.$slots.tip} | ||
{uploadList} | ||
</div> | ||
); | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters