# uploadApi

用于上传文件

# Usage

```vue
<template>
  <a-button @click="upload">上传文件</a-button>
</template>
<script setup lang="ts">
  import { uploadApi } from '@eciol/api';
  import type { UploadFileParams } from '@eciol/types';

  const upload = () => {
    const params: UploadFileParams = {
      name: 'file',
      file: File,
    };
    // 伪代码，上传文件
    uploadApi(params);
  }
</script>
```

# API参数

```ts
interface UploadFileParams {
    data?: Recordable<any>;
    name?: string;
    file: File | Blob;
    filename?: string;
    [key: string]: any;
}

declare namespace UploadService {
    interface FileItemResult {
        id: string;
        name: string;
        url: string;
        size: number;
    }
    interface UploadApiResult {
        results: FileItemResult[];
        total: number;
    }
    type DownloadApiResult = Blob;
    interface GetFileListParams {
        fileids: string;
    }
}

declare function uploadApi(params: UploadFileParams, onUploadProgress: any): Promise<UploadService.UploadApiResult>;
```
