add attr events

1.0 v0.3.5
git 10 years ago
parent 10811a3c32
commit 7091fb7013

30
dist/example.js vendored

@ -10764,6 +10764,10 @@
},
size: {
type: Number
},
events: {
type: Object,
default: function _default() {}
}
},
@ -10844,8 +10848,7 @@
iframe.onabort({ type: 'abort' });
}
delete this._files[id];
this.$dispatch && this.$dispatch('removeFileUpload', file, this);
this.removeFileUpload && this.removeFileUpload(file);
this._events('removeFileUpload', file);
}
this._index = 0;
},
@ -10867,6 +10870,11 @@
this.files.splice(0, this.files.length);
}
},
_events: function _events(name, file) {
this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this);
},
_drop: function _drop(value) {
if (this.dropElement && this.$mode === 'html5') {
try {
@ -10943,8 +10951,7 @@
this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file;
this.$dispatch && this.$dispatch('addFileUpload', file, this);
this.addFileUpload && this.addFileUpload(file);
this._events('addFileUpload', file);
},
_onDrop: function _onDrop(e) {
this._dropActive = 0;
@ -11060,8 +11067,7 @@
speedTime = speedTime2;
}
}
_self.$dispatch && _self.$dispatch('fileUploadProgress', file, _self);
_self.fileUploadProgress && _self.fileUploadProgress(file);
_self._events('fileUploadProgress', file);
};
var callback = function callback(e) {
@ -11110,8 +11116,7 @@
if (!fileUploads) {
fileUploads = true;
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function () {
_self._fileUploads();
@ -11156,8 +11161,7 @@
}
}
}, 100);
this.$dispatch && this.$dispatch('beforeFileUpload', file, this);
this.beforeFileUpload && this.beforeFileUpload(file);
this._events('beforeFileUpload', file);
},
_fileUploadPut: function _fileUploadPut(file) {
var _self = this;
@ -11304,8 +11308,7 @@
fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function () {
_self._fileUploads();
@ -11332,8 +11335,7 @@
}
}
}, 50);
_self.$dispatch && _self.$dispatch('beforeFileUpload', file, this);
_self.beforeFileUpload && _self.beforeFileUpload(file);
_self._events('beforeFileUpload', file);
}, 10);
}
}

File diff suppressed because one or more lines are too long

@ -650,6 +650,10 @@ return /******/ (function(modules) { // webpackBootstrap
},
size: {
type: Number
},
events: {
type: Object,
default: function _default() {}
}
},
@ -730,8 +734,7 @@ return /******/ (function(modules) { // webpackBootstrap
iframe.onabort({ type: 'abort' });
}
delete this._files[id];
this.$dispatch && this.$dispatch('removeFileUpload', file, this);
this.removeFileUpload && this.removeFileUpload(file);
this._events('removeFileUpload', file);
}
this._index = 0;
},
@ -753,6 +756,11 @@ return /******/ (function(modules) { // webpackBootstrap
this.files.splice(0, this.files.length);
}
},
_events: function _events(name, file) {
this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this);
},
_drop: function _drop(value) {
if (this.dropElement && this.$mode === 'html5') {
try {
@ -829,8 +837,7 @@ return /******/ (function(modules) { // webpackBootstrap
this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file;
this.$dispatch && this.$dispatch('addFileUpload', file, this);
this.addFileUpload && this.addFileUpload(file);
this._events('addFileUpload', file);
},
_onDrop: function _onDrop(e) {
this._dropActive = 0;
@ -946,8 +953,7 @@ return /******/ (function(modules) { // webpackBootstrap
speedTime = speedTime2;
}
}
_self.$dispatch && _self.$dispatch('fileUploadProgress', file, _self);
_self.fileUploadProgress && _self.fileUploadProgress(file);
_self._events('fileUploadProgress', file);
};
var callback = function callback(e) {
@ -996,8 +1002,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!fileUploads) {
fileUploads = true;
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function () {
_self._fileUploads();
@ -1042,8 +1047,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
}, 100);
this.$dispatch && this.$dispatch('beforeFileUpload', file, this);
this.beforeFileUpload && this.beforeFileUpload(file);
this._events('beforeFileUpload', file);
},
_fileUploadPut: function _fileUploadPut(file) {
var _self = this;
@ -1190,8 +1194,7 @@ return /******/ (function(modules) { // webpackBootstrap
fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function () {
_self._fileUploads();
@ -1218,8 +1221,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
}, 50);
_self.$dispatch && _self.$dispatch('beforeFileUpload', file, this);
_self.beforeFileUpload && _self.beforeFileUpload(file);
_self._events('beforeFileUpload', file);
}, 10);
}
}

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",
"description": "Vue.js file upload component, Support for multiple file uploads, progress, html5, html4, support ie9",
"version": "0.3.4",
"version": "0.3.5",
"author": "LianYue",
"scripts": {
"dev": "webpack-dev-server --inline --hot",

@ -78,6 +78,10 @@ export default {
size: {
type: Number,
},
events: {
type: Object,
default: () => {},
},
},
components: {
@ -162,8 +166,7 @@ export default {
iframe.onabort({type:'abort'});
}
delete this._files[id];
this.$dispatch && this.$dispatch('removeFileUpload', file, this);
this.removeFileUpload && this.removeFileUpload(file);
this._events('removeFileUpload', file);
}
this._index = 0;
},
@ -188,6 +191,12 @@ export default {
}
},
_events(name, file) {
this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this);
},
_drop(value) {
if (this.dropElement && this.$mode === 'html5') {
try {
@ -266,8 +275,7 @@ export default {
this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file;
this.$dispatch && this.$dispatch('addFileUpload', file, this);
this.addFileUpload && this.addFileUpload(file);
this._events('addFileUpload', file);
},
_onDrop(e) {
this._dropActive = 0;
@ -389,8 +397,7 @@ export default {
speedTime = speedTime2;
}
}
_self.$dispatch && _self.$dispatch('fileUploadProgress', file, _self);
_self.fileUploadProgress && _self.fileUploadProgress(file);
_self._events('fileUploadProgress', file);
};
@ -440,8 +447,7 @@ export default {
if (!fileUploads) {
fileUploads = true;
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function() {
_self._fileUploads();
@ -489,8 +495,7 @@ export default {
}
}
}, 100);
this.$dispatch && this.$dispatch('beforeFileUpload', file, this);
this.beforeFileUpload && this.beforeFileUpload(file);
this._events('beforeFileUpload', file);
},
_fileUploadPut(file) {
var _self = this;
@ -652,8 +657,7 @@ export default {
fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) {
_self.$dispatch && _self.$dispatch('afterFileUpload', file, _self);
_self.afterFileUpload && _self.afterFileUpload(file);
_self._events('afterFileUpload', file);
}
setTimeout(function() {
@ -663,7 +667,6 @@ export default {
};
setTimeout(function() {
document.body.appendChild(iframe).appendChild(form).submit();
iframe.onload = callback;
@ -683,8 +686,7 @@ export default {
}
}
}, 50);
_self.$dispatch && _self.$dispatch('beforeFileUpload', file, this);
_self.beforeFileUpload && _self.beforeFileUpload(file);
_self._events('beforeFileUpload', file);
}, 10);
},

Loading…
Cancel
Save