1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
index.en-US.md 5.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
yezongjie Отправлено 2 лет назад 0a2783b
category subtitle type title
Pro Components
附件
Data Entry
Attachment

附件上传和展示

何时使用

需要上传文件时。

API

Attachment

属性说明如下:

属性 说明 类型 默认值
accept 接受上传的文件类型 input accept Attribute string[]
data 上传所需参数 object
headers 设置上传的请求头部,IE10 以上有效 object
multiple 是否支持多选,IE10 以上有效 boolean true
withCredentials 上传请求时是否携带 cookie boolean false
listType 上传列表的内建样式,支持三种基本样式 text, picturepicture-card string 'text'
viewMode 上传列表的显示模式,支持三种基本样式 none, listpopup string 'list'
sortable 是否可排序, 只读模式下不可拖拽 boolean true
fileKey 上传文件的参数名 string attachment.defaultFileKey
fileSize 上传文件的大小限制, 单位 B number attachment.defaultFileSize
useChunk 是否开启分片上传 boolean
chunkSize 分片大小 number attachment.defaultChunkSize
chunkThreads 分片上传并发数 number attachment.defaultChunkThreads
pictureWidth 图片尺寸, 只适用于 listType 为 picture 和 picture-card number
count 自定义附件数量 number
max 同时上传文件的最大数量, 0 表示无限制 number
listLimit 上传列表最大显示数量,只适用于只读模式 number
showHistory 可显示操作历史记录 boolean
showSize 显示文件大小信息 boolean true
downloadAll 是否显示全部下载按钮,只适用于只读模式, 必须配置attachment.getDownloadAllUrl boolean | ButtonProps true
bucketName 附件上传的桶名 string
bucketDirectory 附件上传的桶目录 string
storageCode 附件存储编码 string
template 附件模板 { bucketName?: string, bucketDirectory?: string, storageCode?:string, attachmentUUID: string, isPublic?: boolean }
previewTarget 预览链接跳转对象, 如要在iframe内预览, 可给 iframe 指定 name={previewTarget} string 'attachment-preview'
isPublic 是否是公共的, attachment配置中相关钩子会使用该属性 boolean
attachments 附件列表 (AttachmentFile | FileLike)[]
showValidation 校验信息展示方式 newLine | tooltip viewMode == popup ? tooltip : newLine
getUUID 获取 uuid () => Promise | string attachment.getAttachmentUUID
buttons 功能按钮,默认存在downloadremove值,可传递数组、自定义按钮或按钮配置属性对象,数组为可选值字符串+按钮配置属性对象(非默认按钮需添加唯一 key) string[] | [string, object] | ReactNode[] | object [['download', 'remove']]
onAttachmentsChange 附件列表变更事件 (AttachmentFile[]) => void
beforeUpload 上传文件之前的钩子,参数为上传的文件,可对文件在上传之前进行校验操作若返回 false 则停止上传并从列表充删除。支持返回一个 Promise 对象,Promise 对象 reject 或 resolve(false) 时则停止上传,resolve 时开始上传。 (attachment: AttachmentFile, list: AttachmentFile[]) => (boolean | Promise) -
onUploadProgress 上传进度变化的回调 (percent: number, attachment: AttachmentFile) => void
onUploadSuccess 上传成功的回调 (response: any, attachment: AttachmentFile) => void
onUploadError 上传出错的回调 (error: Error, attachment: AttachmentFile) => void
getPreviewUrl 获取预览地址,默认使用 AttachmentFile.url,返回空则不可预览。其中函数的返回值为 (() => string | Promise< string>) 时,仅支持 listType 为 text 的情况 ({ attachment: AttachmentFile, bucketName?: string, bucketDirectory?: string, storageCode?:string, attachmentUUID: string, isPublic?: boolean }) => (string | (() => string | Promise< string>) | undefined)

更多属性请参考 FormFieldButton。 附件对象参考 AttachmentFile 全局配置参考 attachment

Attachment.Group

附件组, 属性如下:

属性 说明 类型 默认值
viewMode 上传列表的显示模式,支持两种基本样式 listpopup string 'popup'
text 按钮文字 ReactNode
count 自定义附件数量, 未设置时会自动获取组内的附件数量 number

更多属性请参考 Button

Attachment.Dragger

属性 说明 类型 默认值
attachmentChildren 上传组件 children ReactNode $l('Attachment', 'upload_attachment')

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
master