1.0 v0.3.7
git 9 years ago
parent 58267e3c0b
commit 601c0c403b

18
dist/example.js vendored

@ -10884,15 +10884,17 @@
file.removed = true; file.removed = true;
var xhr = this._files[id].xhr; var xhr = this._files[id].xhr;
if (xhr) { if (xhr) {
try {
xhr.abort(); xhr.abort();
xhr.timeout = 1; xhr.timeout = 1;
} catch (e) {}
} }
var iframe = this._files[id].iframe; var iframe = this._files[id].iframe;
if (iframe) { if (iframe) {
iframe.onabort({ type: 'abort' }); iframe.onabort({ type: 'abort' });
} }
delete this._files[id]; delete this._files[id];
this._events('removeFileUpload', file); this._uploadEvents('removeFileUpload', file);
} }
this._index = 0; this._index = 0;
}, },
@ -10914,7 +10916,7 @@
this.files.splice(0, this.files.length); this.files.splice(0, this.files.length);
} }
}, },
_events: function _events(name, file) { _uploadEvents: function _uploadEvents(name, file) {
this.$dispatch && this.$dispatch(name, file, this); this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file); this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this); this.events && this.events[name] && this.events[name](file, this);
@ -10995,7 +10997,7 @@
this._files[file.id] = hiddenData; this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1]; file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file; this._files[file.id]._file = file;
this._events('addFileUpload', file); this._uploadEvents('addFileUpload', file);
}, },
_onDrop: function _onDrop(e) { _onDrop: function _onDrop(e) {
this._dropActive = 0; this._dropActive = 0;
@ -11111,7 +11113,7 @@
speedTime = speedTime2; speedTime = speedTime2;
} }
} }
_self._events('fileUploadProgress', file); _self._uploadEvents('fileUploadProgress', file);
}; };
var callback = function callback(e) { var callback = function callback(e) {
@ -11160,7 +11162,7 @@
if (!fileUploads) { if (!fileUploads) {
fileUploads = true; fileUploads = true;
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function () { setTimeout(function () {
_self._fileUploads(); _self._fileUploads();
@ -11205,7 +11207,7 @@
} }
} }
}, 100); }, 100);
this._events('beforeFileUpload', file); this._uploadEvents('beforeFileUpload', file);
}, },
_fileUploadPut: function _fileUploadPut(file) { _fileUploadPut: function _fileUploadPut(file) {
var _self = this; var _self = this;
@ -11352,7 +11354,7 @@
fileUploads = true; fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe); iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function () { setTimeout(function () {
_self._fileUploads(); _self._fileUploads();
@ -11379,7 +11381,7 @@
} }
} }
}, 50); }, 50);
_self._events('beforeFileUpload', file); _self._uploadEvents('beforeFileUpload', file);
}, 10); }, 10);
} }
} }

File diff suppressed because one or more lines are too long

@ -726,15 +726,17 @@ return /******/ (function(modules) { // webpackBootstrap
file.removed = true; file.removed = true;
var xhr = this._files[id].xhr; var xhr = this._files[id].xhr;
if (xhr) { if (xhr) {
try {
xhr.abort(); xhr.abort();
xhr.timeout = 1; xhr.timeout = 1;
} catch (e) {}
} }
var iframe = this._files[id].iframe; var iframe = this._files[id].iframe;
if (iframe) { if (iframe) {
iframe.onabort({ type: 'abort' }); iframe.onabort({ type: 'abort' });
} }
delete this._files[id]; delete this._files[id];
this._events('removeFileUpload', file); this._uploadEvents('removeFileUpload', file);
} }
this._index = 0; this._index = 0;
}, },
@ -756,7 +758,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.files.splice(0, this.files.length); this.files.splice(0, this.files.length);
} }
}, },
_events: function _events(name, file) { _uploadEvents: function _uploadEvents(name, file) {
this.$dispatch && this.$dispatch(name, file, this); this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file); this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this); this.events && this.events[name] && this.events[name](file, this);
@ -837,7 +839,7 @@ return /******/ (function(modules) { // webpackBootstrap
this._files[file.id] = hiddenData; this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1]; file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file; this._files[file.id]._file = file;
this._events('addFileUpload', file); this._uploadEvents('addFileUpload', file);
}, },
_onDrop: function _onDrop(e) { _onDrop: function _onDrop(e) {
this._dropActive = 0; this._dropActive = 0;
@ -953,7 +955,7 @@ return /******/ (function(modules) { // webpackBootstrap
speedTime = speedTime2; speedTime = speedTime2;
} }
} }
_self._events('fileUploadProgress', file); _self._uploadEvents('fileUploadProgress', file);
}; };
var callback = function callback(e) { var callback = function callback(e) {
@ -1002,7 +1004,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!fileUploads) { if (!fileUploads) {
fileUploads = true; fileUploads = true;
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function () { setTimeout(function () {
_self._fileUploads(); _self._fileUploads();
@ -1047,7 +1049,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
}, 100); }, 100);
this._events('beforeFileUpload', file); this._uploadEvents('beforeFileUpload', file);
}, },
_fileUploadPut: function _fileUploadPut(file) { _fileUploadPut: function _fileUploadPut(file) {
var _self = this; var _self = this;
@ -1194,7 +1196,7 @@ return /******/ (function(modules) { // webpackBootstrap
fileUploads = true; fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe); iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function () { setTimeout(function () {
_self._fileUploads(); _self._fileUploads();
@ -1221,7 +1223,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
}, 50); }, 50);
_self._events('beforeFileUpload', file); _self._uploadEvents('beforeFileUpload', file);
}, 10); }, 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", "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.3.6", "version": "0.3.7",
"author": "LianYue", "author": "LianYue",
"scripts": { "scripts": {
"dev": "webpack-dev-server --inline --hot", "dev": "webpack-dev-server --inline --hot",

@ -133,7 +133,7 @@ export default {
this.files = []; this.files = [];
}, },
watch: { watch: {
drop(value) { drop(value) {
this._drop(value); this._drop(value);
}, },
@ -157,15 +157,19 @@ watch: {
file.removed = true; file.removed = true;
var xhr = this._files[id].xhr; var xhr = this._files[id].xhr;
if (xhr) { if (xhr) {
try {
xhr.abort(); xhr.abort();
xhr.timeout = 1; xhr.timeout = 1;
} catch (e) {
}
} }
var iframe = this._files[id].iframe; var iframe = this._files[id].iframe;
if (iframe) { if (iframe) {
iframe.onabort({type:'abort'}); iframe.onabort({type:'abort'});
} }
delete this._files[id]; delete this._files[id];
this._events('removeFileUpload', file); this._uploadEvents('removeFileUpload', file);
} }
this._index = 0; this._index = 0;
}, },
@ -190,7 +194,7 @@ watch: {
} }
}, },
_events(name, file) { _uploadEvents(name, file) {
this.$dispatch && this.$dispatch(name, file, this); this.$dispatch && this.$dispatch(name, file, this);
this[name] && this[name](file); this[name] && this[name](file);
this.events && this.events[name] && this.events[name](file, this); this.events && this.events[name] && this.events[name](file, this);
@ -274,7 +278,7 @@ watch: {
this._files[file.id] = hiddenData; this._files[file.id] = hiddenData;
file = this.files[this.files.push(file) - 1]; file = this.files[this.files.push(file) - 1];
this._files[file.id]._file = file; this._files[file.id]._file = file;
this._events('addFileUpload', file); this._uploadEvents('addFileUpload', file);
}, },
_onDrop(e) { _onDrop(e) {
this._dropActive = 0; this._dropActive = 0;
@ -396,7 +400,7 @@ watch: {
speedTime = speedTime2; speedTime = speedTime2;
} }
} }
_self._events('fileUploadProgress', file); _self._uploadEvents('fileUploadProgress', file);
}; };
@ -446,7 +450,7 @@ watch: {
if (!fileUploads) { if (!fileUploads) {
fileUploads = true; fileUploads = true;
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function() { setTimeout(function() {
_self._fileUploads(); _self._fileUploads();
@ -494,7 +498,7 @@ watch: {
} }
} }
}, 100); }, 100);
this._events('beforeFileUpload', file); this._uploadEvents('beforeFileUpload', file);
}, },
_fileUploadPut(file) { _fileUploadPut(file) {
var _self = this; var _self = this;
@ -656,7 +660,7 @@ watch: {
fileUploads = true; fileUploads = true;
iframe.parentNode && iframe.parentNode.removeChild(iframe); iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._uploadEvents('afterFileUpload', file);
} }
setTimeout(function() { setTimeout(function() {
_self._fileUploads(); _self._fileUploads();
@ -684,7 +688,7 @@ watch: {
} }
} }
}, 50); }, 50);
_self._events('beforeFileUpload', file); _self._uploadEvents('beforeFileUpload', file);
}, 10); }, 10);
}, },
} }

Loading…
Cancel
Save