event listener part of akaunting dropzone is arranged
This commit is contained in:
		@@ -107,81 +107,28 @@ export default {
 | 
			
		||||
                    if (self.options.maxFiles == 1) {
 | 
			
		||||
                        self.$emit('change', file);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        self.$emit('change', this.files);
 | 
			
		||||
                        self.$emit('change', self.files);
 | 
			
		||||
                    }
 | 
			
		||||
                }),
 | 
			
		||||
                this.on("removedfile", function (file) {
 | 
			
		||||
                    let index = self.files.findIndex(f => f.upload.uuid === file.upload.uuid);
 | 
			
		||||
 | 
			
		||||
                    if (index !== -1) {
 | 
			
		||||
                        self.files.splice(index, 1);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    self.$emit('change', self.files);
 | 
			
		||||
                }),
 | 
			
		||||
                this.on("maxfilesexceeded", function(file) {
 | 
			
		||||
                    this.removeAllFiles('notCancel');
 | 
			
		||||
                    this.addFile(file);
 | 
			
		||||
                });
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            this.dropzone = new Dropzone(this.$el, finalOptions);
 | 
			
		||||
 | 
			
		||||
            preview.innerHTML = '';
 | 
			
		||||
 | 
			
		||||
            let evtList = [
 | 
			
		||||
              'drop',
 | 
			
		||||
              'dragstart',
 | 
			
		||||
              'dragend',
 | 
			
		||||
              'dragenter',
 | 
			
		||||
              'dragover',
 | 
			
		||||
              'addedfile',
 | 
			
		||||
              'removedfile',
 | 
			
		||||
              'thumbnail',
 | 
			
		||||
              'error',
 | 
			
		||||
              'processing',
 | 
			
		||||
              'uploadprogress',
 | 
			
		||||
              'sending',
 | 
			
		||||
              'success',
 | 
			
		||||
              'complete',
 | 
			
		||||
              'canceled',
 | 
			
		||||
              'maxfilesreached',
 | 
			
		||||
              'maxfilesexceeded',
 | 
			
		||||
              'processingmultiple',
 | 
			
		||||
              'sendingmultiple',
 | 
			
		||||
              'successmultiple',
 | 
			
		||||
              'completemultiple',
 | 
			
		||||
              'canceledmultiple',
 | 
			
		||||
              'totaluploadprogress',
 | 
			
		||||
              'reset',
 | 
			
		||||
              'queuecomplete',
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            evtList.forEach(evt => {
 | 
			
		||||
                this.dropzone.on(evt, (file) => {
 | 
			
		||||
                    this.$emit(evt, file);
 | 
			
		||||
                    /*
 | 
			
		||||
                    if (evt === 'addedfile') {
 | 
			
		||||
                        if (self.multiple) {
 | 
			
		||||
                            this.files.push(file);
 | 
			
		||||
 | 
			
		||||
                            this.$emit('change', this.files);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            this.file = file;
 | 
			
		||||
                            this.$emit('change', file);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    */
 | 
			
		||||
                    
 | 
			
		||||
                    if (evt === 'removedfile') {
 | 
			
		||||
                        //if (self.multiple) {
 | 
			
		||||
                            let index = this.files.findIndex(f => f.upload.uuid === file.upload.uuid);
 | 
			
		||||
 | 
			
		||||
                            if (index !== -1) {
 | 
			
		||||
                                this.files.splice(index, 1);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            this.$emit('change', this.files);
 | 
			
		||||
                        //} else {
 | 
			
		||||
                        //    this.file = '';
 | 
			
		||||
 | 
			
		||||
                        //    this.$emit('change', '');
 | 
			
		||||
                        //}
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
            }, this);
 | 
			
		||||
            preview.innerHTML = ''
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user