Skip to content

Commit

Permalink
feat(Upload): add fileKeyName to set form-data name for file. fix #1940
Browse files Browse the repository at this point in the history
  • Loading branch information
bindoon authored and youluna committed Jul 29, 2020
1 parent b735f80 commit 6f5d5f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/tab/index.md
Expand Up @@ -33,8 +33,8 @@ Fusion 提供了三级选项卡,分别用于不同的场景。

| 参数 | 说明 | 类型 | 默认值 |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- |
| activeKey | 被激活的选项卡的 key, 赋值则tab为受控组件, 用户无法切换 | Number/String | - |
| size | 尺寸<br><br>**可选值**:<br>'small', 'medium' | Enum | 'medium' |
| activeKey | 被激活的选项卡的 key, 赋值则tab为受控组件, 用户无法切换 | Number/String | - |
| shape | 外观形态<br><br>**可选值**:<br>'pure', 'wrapped', 'text', 'capsule' | Enum | 'pure' |
| defaultActiveKey | 初始化时被激活的选项卡的 key | Number/String | - |
| animation | 是否开启动效 | Boolean | true |
Expand Down
1 change: 1 addition & 0 deletions docs/upload/index.md
Expand Up @@ -52,6 +52,7 @@
| progressProps | 透传给Progress props | Object | - |
| isPreview | 是否为预览态 | Boolean | - |
| renderPreview | 预览态模式下渲染的内容<br><br>**签名**:<br>Function(value: number) => void<br>**参数**:<br>_value_: {number} 评分值 | Function | - |
| fileKeyName | 文件对象的 key name | String | - |

### Upload.Card

Expand Down
7 changes: 7 additions & 0 deletions src/upload/upload.jsx
Expand Up @@ -167,6 +167,10 @@ class Upload extends Base {
* @param {number} value 评分值
*/
renderPreview: PropTypes.func,
/**
* 文件对象的 key name
*/
fileKeyName: PropTypes.string,
};

static defaultProps = {
Expand Down Expand Up @@ -472,6 +476,8 @@ class Upload extends Base {
rtl,
isPreview,
renderPreview,
name,
fileKeyName = name,
...others
} = this.props;

Expand Down Expand Up @@ -534,6 +540,7 @@ class Upload extends Base {
<div className={cls} style={style} {...otherAttributes}>
<Uploader
{...others}
name={fileKeyName}
beforeUpload={beforeUpload}
dragable={dragable}
disabled={disabled || isExceedLimit}
Expand Down

0 comments on commit 6f5d5f4

Please sign in to comment.