1.0 v0.2.3
git 10 years ago
parent fb26b47ed3
commit faad345518

@ -138,7 +138,7 @@ npm run build
### Props ### Props
``` html ``` html
<file-upload :title="Add upload files" :name="file" :drop="Boolean (true = $parent) or Element or Css Selector" :extensions="Array or String or Regular" :post-action="./post.method" :put-action="./put.method" :accept="accept" :multiple="multiple" :size="size" :timeout="3600000"></file-upload> <file-upload :title="Add upload files" :name="file" :drop="Boolean (true = $parent) or Element or Css Selector" :extensions="Array or String or Regular" :post-action="./post.method" :put-action="./put.method" :accept="accept" :multiple="true" :size="size" :timeout="3600000"></file-upload>
``` ```
``` ```
@ -156,7 +156,7 @@ npm run build
accept="accept" accept="accept"
multiple="multiple" multiple="true or false"
size="max Size" size="max Size"

13
dist/example.js vendored

@ -714,7 +714,7 @@
} }
}; };
}, },
created: function created() { ready: function ready() {
this._drop(this.drop); this._drop(this.drop);
}, },
init: function init() { init: function init() {
@ -736,9 +736,6 @@
watch: { watch: {
multiple: function multiple(newValue) {
console.log(newValue);
},
drop: function drop(value) { drop: function drop(value) {
this._drop(value); this._drop(value);
}, },
@ -787,14 +784,12 @@
methods: { methods: {
_drop: function _drop(value) { _drop: function _drop(value) {
if (this.dropElement) { if (this.dropElement && this.$mode === 'html5') {
try { try {
if (this.$mode === 'html5') {
window.document.removeEventListener('dragenter', this._onDragenter, false); window.document.removeEventListener('dragenter', this._onDragenter, false);
window.document.removeEventListener('dragleave', this._onDragleave, false); window.document.removeEventListener('dragleave', this._onDragleave, false);
this.dropElement.removeEventListener('dragover', this._onDragover, false); this.dropElement.removeEventListener('dragover', this._onDragover, false);
this.dropElement.removeEventListener('drop', this._onDrop, false); this.dropElement.removeEventListener('drop', this._onDrop, false);
}
} catch (e) {} } catch (e) {}
} }
@ -804,13 +799,13 @@
} }
if (typeof value == 'string') { if (typeof value == 'string') {
this.dropElement = document.querySelector(value); this.dropElement = document.querySelector(value) || this.$root.$el.querySelector(value);
} else if (typeof value == 'boolean') { } else if (typeof value == 'boolean') {
this.dropElement = this.$parent.$el; this.dropElement = this.$parent.$el;
} else { } else {
this.dropElement = this.drop; this.dropElement = this.drop;
} }
if (this.$mode === 'html5') { if (this.dropElement && this.$mode === 'html5') {
window.document.addEventListener('dragenter', this._onDragenter, false); window.document.addEventListener('dragenter', this._onDragenter, false);
window.document.addEventListener('dragleave', this._onDragleave, false); window.document.addEventListener('dragleave', this._onDragleave, false);
this.dropElement.addEventListener('dragover', this._onDragover, false); this.dropElement.addEventListener('dragover', this._onDragover, false);

File diff suppressed because one or more lines are too long

@ -677,7 +677,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
}; };
}, },
created: function created() { ready: function ready() {
this._drop(this.drop); this._drop(this.drop);
}, },
init: function init() { init: function init() {
@ -699,9 +699,6 @@ return /******/ (function(modules) { // webpackBootstrap
watch: { watch: {
multiple: function multiple(newValue) {
console.log(newValue);
},
drop: function drop(value) { drop: function drop(value) {
this._drop(value); this._drop(value);
}, },
@ -750,14 +747,12 @@ return /******/ (function(modules) { // webpackBootstrap
methods: { methods: {
_drop: function _drop(value) { _drop: function _drop(value) {
if (this.dropElement) { if (this.dropElement && this.$mode === 'html5') {
try { try {
if (this.$mode === 'html5') {
window.document.removeEventListener('dragenter', this._onDragenter, false); window.document.removeEventListener('dragenter', this._onDragenter, false);
window.document.removeEventListener('dragleave', this._onDragleave, false); window.document.removeEventListener('dragleave', this._onDragleave, false);
this.dropElement.removeEventListener('dragover', this._onDragover, false); this.dropElement.removeEventListener('dragover', this._onDragover, false);
this.dropElement.removeEventListener('drop', this._onDrop, false); this.dropElement.removeEventListener('drop', this._onDrop, false);
}
} catch (e) {} } catch (e) {}
} }
@ -767,13 +762,13 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (typeof value == 'string') { if (typeof value == 'string') {
this.dropElement = document.querySelector(value); this.dropElement = document.querySelector(value) || this.$root.$el.querySelector(value);
} else if (typeof value == 'boolean') { } else if (typeof value == 'boolean') {
this.dropElement = this.$parent.$el; this.dropElement = this.$parent.$el;
} else { } else {
this.dropElement = this.drop; this.dropElement = this.drop;
} }
if (this.$mode === 'html5') { if (this.dropElement && this.$mode === 'html5') {
window.document.addEventListener('dragenter', this._onDragenter, false); window.document.addEventListener('dragenter', this._onDragenter, false);
window.document.addEventListener('dragleave', this._onDragleave, false); window.document.addEventListener('dragleave', this._onDragleave, false);
this.dropElement.addEventListener('dragover', this._onDragover, false); this.dropElement.addEventListener('dragover', this._onDragover, false);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
{ {
"name": "vue-upload-component", "name": "vue-upload-component",
"description": "Vue.js file upload component, Support for multiple file uploads, progress, html5, html4, support ie9", "description": "Vue.js file upload component, Support for multiple file uploads, progress, html5, html4, support ie9",
"version": "0.2.2", "version": "0.2.3",
"author": "LianYue", "author": "LianYue",
"scripts": { "scripts": {
"dev": "webpack-dev-server --inline --hot", "dev": "webpack-dev-server --inline --hot",

@ -109,10 +109,11 @@ export default {
} }
}, },
created() { ready() {
this._drop(this.drop); this._drop(this.drop);
}, },
init() { init() {
var input = document.createElement('input'); var input = document.createElement('input');
input.type = 'file'; input.type = 'file';
@ -133,9 +134,6 @@ export default {
}, },
watch: { watch: {
multiple(newValue) {
console.log(newValue);
},
drop(value) { drop(value) {
this._drop(value); this._drop(value);
}, },
@ -186,14 +184,12 @@ export default {
methods: { methods: {
_drop(value) { _drop(value) {
if (this.dropElement) { if (this.dropElement && this.$mode === 'html5') {
try { try {
if (this.$mode === 'html5') {
window.document.removeEventListener('dragenter', this._onDragenter, false); window.document.removeEventListener('dragenter', this._onDragenter, false);
window.document.removeEventListener('dragleave', this._onDragleave, false); window.document.removeEventListener('dragleave', this._onDragleave, false);
this.dropElement.removeEventListener('dragover', this._onDragover, false); this.dropElement.removeEventListener('dragover', this._onDragover, false);
this.dropElement.removeEventListener('drop', this._onDrop, false); this.dropElement.removeEventListener('drop', this._onDrop, false);
}
} catch (e) { } catch (e) {
} }
} }
@ -204,13 +200,13 @@ export default {
} }
if (typeof value == 'string') { if (typeof value == 'string') {
this.dropElement = document.querySelector(value); this.dropElement = document.querySelector(value) || this.$root.$el.querySelector(value);
} else if (typeof value == 'boolean') { } else if (typeof value == 'boolean') {
this.dropElement = this.$parent.$el; this.dropElement = this.$parent.$el;
} else { } else {
this.dropElement = this.drop; this.dropElement = this.drop;
} }
if (this.$mode === 'html5') { if (this.dropElement && this.$mode === 'html5') {
window.document.addEventListener('dragenter', this._onDragenter, false); window.document.addEventListener('dragenter', this._onDragenter, false);
window.document.addEventListener('dragleave', this._onDragleave, false); window.document.addEventListener('dragleave', this._onDragleave, false);
this.dropElement.addEventListener('dragover', this._onDragover, false); this.dropElement.addEventListener('dragover', this._onDragover, false);

Loading…
Cancel
Save