# VUpload 组件 API 文档

## 组件简介 | Component Introduction
`VUpload` 是基于 Element Plus 的上传组件，支持多种自定义插槽和方法。

`VUpload` is an upload component based on Element Plus, supporting various custom slots and methods.

---

## Props/属性
| 属性名 | 说明 | 类型 | 是否必填 | 默认值 |
|--------|------|------|----------|--------|
| field  | 上传配置对象，详见下表 | Object | 是 | - |

---

## v-model
- 绑定值类型：`Array`（文件列表）
- 用法：`v-model:file-list="fileList"`

---

## 插槽 | Slots
| 插槽名 | 说明 |
|--------|------|
| default | 默认内容（上传按钮等）|
| trigger | 触发器内容 |
| tip | 提示内容 |
| file | 文件列表项内容 |

---

## 方法 | Methods (通过 ref 调用)
| 方法名 | 说明 |
|--------|------|
| abort(...args) | 取消上传 |
| submit() | 手动上传文件 |
| clearFiles(...args) | 清空文件列表 |
| handleStart(...args) | 手动触发开始上传 |
| handleRemove(...args) | 手动移除文件 |

---

## 示例 | Example
```vue
<template>
  <VUpload v-model:file-list="fileList" :field="fieldConfig" ref="uploadRef">
    <template #default>
      <el-button type="primary">点击上传</el-button>
    </template>
    <template #tip>
      <div>只能上传jpg/png文件，且不超过500kb</div>
    </template>
  </VUpload>
</template>

<script setup>
import { ref } from 'vue'
import { VUpload } from 'your-lib-path'

const fileList = ref([])
const uploadRef = ref(null)
const fieldConfig = {
  action: 'https://jsonplaceholder.typicode.com/posts/',
  multiple: true,
  limit: 3
}
</script> 