-import merge from 'element-ui/src/utils/merge';
import ajax from './ajax';
-import dragger from './dragger';
+import UploadDragger from './upload-dragger.vue';
export default {
- mixins: [dragger],
-
+ components: {
+ UploadDragger
+ },
props: {
type: String,
action: {
@@ -26,7 +26,7 @@ export default {
onSuccess: Function,
onError: Function,
beforeUpload: Function,
- draggable: Boolean,
+ drag: Boolean,
onPreview: {
type: Function,
default: function() {}
@@ -36,7 +36,8 @@ export default {
default: function() {}
},
fileList: Array,
- autoUpload: Boolean
+ autoUpload: Boolean,
+ listType: String
},
data() {
@@ -118,15 +119,12 @@ export default {
render(h) {
let {
handleClick,
- draggable,
- onDrop,
- showCover,
- onPreview,
- onRemove,
+ drag,
handleChange,
multiple,
accept,
- lastestFile
+ listType,
+ uploadFiles
} = this;
const data = {
class: {
@@ -136,32 +134,12 @@ export default {
click: handleClick
}
};
- if (draggable) {
- merge(data.on, {
- dragover: (ev) => {
- ev.preventDefault();
- this.dragOver = true;
- },
- dragleave: (ev) => {
- ev.preventDefault();
- this.dragOver = false;
- },
- drop: (ev) => {
- ev.preventDefault();
- onDrop(ev);
- }
- });
- merge(data.class, {
- 'el-upload--draggable': true,
- 'is-dragOver': this.dragOver,
- 'is-showCover': this.showCover
- });
- }
+ data.class[`el-upload--${listType}`] = true;
return (
{
- showCover
- ?
+ drag
+ ? {this.$slots.default}
: this.$slots.default
}
diff --git a/src/index.js b/src/index.js
index 12bd922b..91639305 100644
--- a/src/index.js
+++ b/src/index.js
@@ -47,7 +47,6 @@ import Icon from '../packages/icon';
import Row from '../packages/row';
import Col from '../packages/col';
import Upload from '../packages/upload';
-import UploadDragger from '../packages/upload-dragger';
import Progress from '../packages/progress';
import Spinner from '../packages/spinner';
import Message from '../packages/message';
@@ -109,7 +108,6 @@ const components = [
Row,
Col,
Upload,
- UploadDragger,
Progress,
Spinner,
Badge,
@@ -203,7 +201,6 @@ module.exports = {
Row,
Col,
Upload,
- UploadDragger,
Progress,
Spinner,
Message,