dist/vue-upload-component.js
// Add file - Generate new Id if not provided
Add file - Generate new Id if not provided
Add file - Generate new Id if not provided
function add(_files) {
      var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addIndex;
      var files = _files;
      var isArray = files instanceof Array;
      if (!isArray) {
        files = [files];
      }
      var addFiles = [];
      for (var i = 0; i < files.length; i++) {
        var file = files[i];
        if (this.features.html5 && file instanceof Blob) {
          file = {
            file: file,
            size: file.size,
            name: file.webkitRelativePath || file.relativePath || file.name || 'unknown',
            type: file.type
          };
        }
        var fileObject = false;
        if (file.fileObject === false) {
        } else if (file.fileObject) {
          fileObject = true;
        } else if (typeof Element !== 'undefined' && file.el instanceof Element) {
          fileObject = true;
        } else if (typeof Blob !== 'undefined' && file.file instanceof Blob) {
          fileObject = true;
        }
        if (fileObject) {
          file = Object.assign({
            fileObject: true,
            size: -1,
            name: 'Filename',
            type: '',
            active: false,
            error: '',
            success: false,
            putAction: this.putAction,
            postAction: this.postAction,
            timeout: this.timeout
          }, file, {
            response: {},
            progress: '0.00',
            speed: 0
          });
          file.data = Object.assign({}, this.data, file.data ? file.data : {});
          file.headers = Object.assign({}, this.headers, file.headers ? file.headers : {});
        }
        if (!file.id) {
          file.id = Math.random().toString(36).substr(2);
        }
        if (this.emitFilter(file, undefined)) {
          continue;
        }
        if (this.maximum > 1 && addFiles.length + this.files.length >= this.maximum) {
          break;
        }
        addFiles.push(file);
        if (this.maximum === 1) {
          break;
        }
      }
      if (!addFiles.length) {
        return false;
      }
      if (this.maximum === 1) {
        this.clear();
      }
      var newFiles = void 0;
      if (index === true || index === 0) {
        newFiles = addFiles.concat(this.files);
      } else if (index) {
        newFiles = addFiles.concat([]);
        newFiles.splice(index, 0, addFiles);
      } else {
        newFiles = this.files.concat(addFiles);
      }
      this.files = newFiles;
      for (var _i = 0; _i < addFiles.length; _i++) {
        var _file2 = addFiles[_i];
        this.maps[_file2.id] = _file2;
      }
      this.emitInput();
      for (var _i2 = 0; _i2 < addFiles.length; _i2++) {
        this.emitFile(addFiles[_i2], undefined);
      }
      return isArray ? addFiles : addFiles[0];
    }
function add ( _files ) { var index = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : this . addIndex ; var files = _files ; var isArray = files instanceof Array ; if ( ! isArray ) { files = [ files ] ; } var addFiles = [ ] ; for ( var i = 0 ; i < files . length ; i ++ ) { var file = files [ i ] ; if ( this . features . html5 && file instanceof Blob ) { file = { file : file , size : file . size , name : file . webkitRelativePath || file . relativePath || file . name || 'unknown' , type : file . type } ; } var fileObject = false ; if ( file . fileObject === false ) { } else if ( file . fileObject ) { fileObject = true ; } else if ( typeof Element !== 'undefined' && file . el instanceof Element ) { fileObject = true ; } else if ( typeof Blob !== 'undefined' && file . file instanceof Blob ) { fileObject = true ; } if ( fileObject ) { file = Object . assign ( { fileObject : true , size : - 1 , name : 'Filename' , type : '' , active : false , error : '' , success : false , putAction : this . putAction , postAction : this . postAction , timeout : this . timeout } , file , { response : { } , progress : '0.00' , speed : 0 } ) ; file . data = Object . assign ( { } , this . data , file . data ? file . data : { } ) ; file . headers = Object . assign ( { } , this . headers , file . headers ? file . headers : { } ) ; } if ( ! file . id ) { file . id = Math . random ( ) . toString ( 36 ) . substr ( 2 ) ; } if ( this . emitFilter ( file , undefined ) ) { continue ; } if ( this . maximum > 1 && addFiles . length + this . files . length >= this . maximum ) { break ; } addFiles . push ( file ) ; if ( this . maximum === 1 ) { break ; } } if ( ! addFiles . length ) { return false ; } if ( this . maximum === 1 ) { this . clear ( ) ; } var newFiles = void 0 ; if ( index === true || index === 0 ) { newFiles = addFiles . concat ( this . files ) ; } else if ( index ) { newFiles = addFiles . concat ( [ ] ) ; newFiles . splice ( index , 0 , addFiles ) ; } else { newFiles = this . files . concat ( addFiles ) ; } this . files = newFiles ; for ( var _i = 0 ; _i < addFiles . length ; _i ++ ) { var _file2 = addFiles [ _i ] ; this . maps [ _file2 . id ] = _file2 ; } this . emitInput ( ) ; for ( var _i2 = 0 ; _i2 < addFiles . length ; _i2 ++ ) { this . emitFile ( addFiles [ _i2 ] , undefined ) ; } return isArray ? addFiles : addFiles [ 0 ] ; }
Add file - Generate new Id if not provided
Add file - Generate new Id if not provided
// false