Skip to content

Commit 5915221

Browse files
xiaodemenJustineo
authored andcommitted
docs: update uploader doc
Change-Id: Ibec3a0e4f82da167849513a254af8b4c21a80d0c
1 parent cbdff4a commit 5915221

File tree

1 file changed

+60
-8
lines changed

1 file changed

+60
-8
lines changed

one/docs/components/uploader.md

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,16 @@
8282
| ``controls`` | `function(Object, Array<Object>): Array<Object>` | - | [^controls] |
8383
| ``multiple`` | `boolean` | `false` | 上传多个文件,当 `max-count``1``multiple``true`,那么 `value` 也是数组。 |
8484
| ``entries`` | `function(Array<Object>): Array<Object>` | - | [^entries] |
85+
| ``pick`` | `function(number): Promise<Object>` | - | [^pick] |
8586
| ``after-pick`` | `function(Array<Object>): void` | - | 选择文件之后的回调。 |
8687
| ``sortable`` | `boolean` | `false` | 文件列表是否可以排序。 |
8788
| ``preview-options`` | `object` | `{wrap: true, indicator: 'number'}` | 传递给 [`Lightbox`](./lightbox) 的预览选项。 |
89+
| ``preview-options`` | `object` | `{wrap: true, indicator: 'number'}` | 传递给 [`Lightbox`](./lightbox) 的预览选项。 |
90+
| ``validity-display`` | `'popup' | 'inline'` | `'popup'` | [^validity-display] |
91+
| ``help`` | `string` | - | 帮助文本。 |
92+
| ``help-position`` | `'side' | 'bottom'` | `'side'` | [^help-position] |
93+
| ``picker-label`` | `string` | - | 上传按钮的文本。 |
94+
| ``picker-icon`` | `string | Object` | - | 上传按钮的图标,参考 [`Icon`](./icon)[`name`](./icon#props-name) 属性。 |
8895

8996

9097
^^^ui
@@ -185,9 +192,61 @@
185192
| -- | -- |
186193
| `before` | 上传按钮始终在队列最前面。 |
187194
| `after` | 上传按钮始终在队列最后面。 |
195+
| `top` | 上传按钮始终在队列上面。 |
196+
| `none` | 不展示上传按钮。 |
197+
+++
198+
^^^
199+
200+
^^^pick
201+
自定义选择文件逻辑, 返回的文件会被上传。
202+
203+
```ts
204+
function picker() : Promise<PickedFile | PickedFile[]>
205+
206+
type PickedFile = {
207+
name: string
208+
type: string
209+
src: string
210+
poster?: string
211+
alt?: string
212+
size?: number
213+
}
214+
```
215+
+++枚举值
216+
| 值 | 描述 |
217+
| -- | -- |
218+
| `name` | 文件名称。 |
219+
| `type` | 文件类型。 |
220+
| `src` | 文件地址。 |
221+
| `poster` | 视频文件的预览图片。 |
222+
| `alt` | 替换文本。 |
223+
| `size` | 文件大小。 |
188224
+++
189225
^^^
190226
227+
^^^validity-display
228+
校验信息的展示方式。
229+
230+
+++枚举值
231+
| 值 | 描述 |
232+
| -- | -- |
233+
| `popup` | 悬浮时浮层展示校验信息。 |
234+
| `inline` | 内联显示校验信息。 |
235+
+++
236+
^^^
237+
238+
^^^help-position
239+
帮助信息的展示位置。
240+
241+
+++枚举值
242+
| 值 | 描述 |
243+
| -- | -- |
244+
| `side` | 展示在上传按钮的右边。 |
245+
| `bottom` | 展示在上传按钮的下面。 |
246+
+++
247+
^^^
248+
249+
191250
^^^validator
192251
自定义校验逻辑,参数为原生 [`File`](https://developer.mozilla.org/zh-CN/docs/Web/API/File) 对象。返回结果的格式要求如下:
193252
@@ -235,21 +294,14 @@
235294
236295
| 名称 | 描述 |
237296
| -- | -- |
238-
| ``button-label`` | [^button-label] |
239297
| ``upload`` | 图片上传模式下,上传按钮的区域。 |
240-
| ``desc`` | 对文件数量、格式、大小等的提示内容。 |
298+
| ``help`` | 对文件数量、格式、大小等的提示内容。 |
241299
| ``file`` | [^file] |
242300
| ``file-before`` | 单个文件内容之前的区域。作用域参数与 [`file`](#slots-file) 插槽相同。 |
243301
| ``file-after`` | 单个文件内容之后的区域。作用域参数与 [`file`](#slots-file) 插槽相同。 |
244302
| ``uploading`` | 图片上传模式下,上传中的单个图片的区域。作用域参数与 [`file`](#slots-file) 插槽相同。 |
245303
| ``failure`` | 图片上传模式下,上传失败的单个图片的区域。作用域参数与 [`file`](#slots-file) 插槽相同。 |
246304
247-
^^^button-label
248-
上传按钮里的内容。
249-
250-
默认内容:文件上传为提示选择文件,图片上传则为上传图片图标。
251-
^^^
252-
253305
^^^file
254306
单个文件的区域,用来定制文件内容。
255307

0 commit comments

Comments
 (0)