Appearance
useUpload
▸ useUpload(props): ProFormUploadDraggerProps
需与 Pro Component Upload 组件配合使用
- 优化 upload 组件的传参,支持直接传入 path 或者 path[],如 'https://xxxx.jpg' 或 ['https://xxxx.jpg']
- 支持通过上传进度控制上传按钮的 loading 状态
- 支持限制文件大小
- 支持多文件上传
- 支持指定文件上传的 category
- 兼容文件裁剪
参数
| Name | Type |
|---|---|
props | FileUploadOptions & {} & Omit<ProFormItemProps, "valueType"> & Pick<ProFormGridConfig, "colProps"> & ExtendsProps & {} |
返回值
ProFormUploadDraggerProps
示例
ts
export default function UploadButton(props) {
const uploadProps = useUpload(props)
return <ProFormUploadButton {...uploadProps} />
}