沈斌
2017-12-15 f9b157566af34b8dc28ba10b34d025ac04f3168b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Component } from '@angular/core';
import { FileUploader } from 'ng2-file-upload';
 
const URL = 'https://test.com/';
 
@Component({
    selector: 'app-upload',
    templateUrl: './upload.component.html'
})
export class UploadComponent {
 
    uploader: FileUploader = new FileUploader({
        url: URL,
        isHTML5: true
    });
 
    hasBaseDropZoneOver = false;
    hasAnotherDropZoneOver = false;
    files: any[] = [];
 
    fileOverBase(e: any): void {
        this.hasBaseDropZoneOver = e;
    }
 
    fileOverAnother(e: any): void {
        this.hasAnotherDropZoneOver = e;
    }
 
    constructor() {
        this.uploader.onAfterAddingFile = (f) => {
            this.files = this.uploader.queue;
            return f;
        };
    }
}