Skip to content

Commit

Permalink
doc: upload doc line break (ant-design#44234)
Browse files Browse the repository at this point in the history
  • Loading branch information
1587315093 authored Aug 15, 2023
1 parent 9ec8534 commit 4fb448f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions components/upload/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Extends File with additional props.
When uploading state change, it returns:

```js
```jsx
{
file: { /* ... */ },
fileList: [ /* ... */ ],
Expand All @@ -108,11 +108,11 @@ When uploading state change, it returns:

1. `file` File object for the current operation.

```js
```jsx
{
uid: 'uid', // unique identifier, negative is recommended, to prevent interference with internally generated id
name: 'xx.png', // file name
status: 'done', // options: uploading, done, error, removed. Intercepted file by beforeUpload doesn't have a status field.
status: 'done' | 'uploading' | 'error' | 'removed', // Intercepted file by beforeUpload doesn't have a status field.
response: '{"status": "success"}', // response from server
linkProps: '{"download": "image"}', // additional HTML props of file link
xhr: 'XMLHttpRequest{ ... }', // XMLHttpRequest Header
Expand Down Expand Up @@ -152,7 +152,9 @@ For compatible case, we return File object when `beforeUpload` return `false`. I
### Why sometimes Chrome can not upload?
Chrome update will also break native upload. Please restart Chrome to finish the upload work. Ref:
Chrome update will also break native upload. Please restart Chrome to finish the upload work.
Ref:
- [#32672](https://github.com/ant-design/ant-design/issues/32672)
- [#32913](https://github.com/ant-design/ant-design/issues/32913)
Expand Down
14 changes: 8 additions & 6 deletions components/upload/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ demo:
文件状态改变的回调,返回为:

```js
```jsx
{
file: { /* ... */ },
fileList: [ /* ... */ ],
Expand All @@ -109,11 +109,11 @@ demo:

1. `file` 当前操作的文件对象。

```js
```jsx
{
uid: 'uid', // 文件唯一标识,建议设置为负数,防止和内部产生的 id 冲突
name: 'xx.png', // 文件名
status: 'done', // 状态有:uploading done error removed,被 beforeUpload 拦截的文件没有 status 属性
status: 'done' | 'uploading' | 'error' | 'removed' , // beforeUpload 拦截的文件没有 status 状态属性
response: '{"status": "success"}', // 服务端响应内容
linkProps: '{"download": "image"}', // 下载链接额外的 HTML 属性
}
Expand All @@ -136,7 +136,7 @@ demo:

### 如何显示下载链接?

请使用 fileList 属性设置数组项的 url 属性进行展示控制。
请使用 `fileList` 属性设置数组项的 `url` 属性进行展示控制。

### `customRequest` 怎么使用?

Expand All @@ -148,11 +148,13 @@ demo:

### `onChange` 为什么有时候返回 File 有时候返回 { originFileObj: File }?

历史原因,在 `beforeUpload` 返回 `false` 时,会返回 File 对象。在下个大版本我们会统一返回 `{ originFileObj: File }` 对象。当前版本已经兼容所有场景下 `info.file.originFileObj` 获取原 File 写法。你可以提前切换。
历史原因,在 `beforeUpload` 返回 `false` 时,会返回 `File` 对象。在下个大版本我们会统一返回 `{ originFileObj: File }` 对象。当前版本已经兼容所有场景下 `info.file.originFileObj` 获取原 `File` 写法。你可以提前切换。

### 为何有时 Chrome 点击 Upload 无法弹出文件选择框?

与 antd 无关,原生上传也会失败。请重启 Chrome 浏览器,让其完成升级工作。相关 issue:
`antd` 无关,原生上传也会失败。请重启 `Chrome` 浏览器,让其完成升级工作。

相关 `issue`

- [#32672](https://github.com/ant-design/ant-design/issues/32672)
- [#32913](https://github.com/ant-design/ant-design/issues/32913)
Expand Down

0 comments on commit 4fb448f

Please sign in to comment.