mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
feat add uploadlist config and fix color
This commit is contained in:
parent
440f69a800
commit
9cb8bef1ad
@ -12,6 +12,7 @@ const Dragger = Upload.Dragger;
|
|||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
name: 'file',
|
name: 'file',
|
||||||
|
uploadList: false,
|
||||||
action: '/upload.do'
|
action: '/upload.do'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ const Dragger = Upload.Dragger;
|
|||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
name: 'file',
|
name: 'file',
|
||||||
|
uploadList: false,
|
||||||
action: '/upload.do'
|
action: '/upload.do'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ const AntUpload = React.createClass({
|
|||||||
data: {},
|
data: {},
|
||||||
accept: '',
|
accept: '',
|
||||||
onChange: noop,
|
onChange: noop,
|
||||||
|
uploadList: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
@ -188,6 +189,10 @@ const AntUpload = React.createClass({
|
|||||||
onProgress: this.onProgress,
|
onProgress: this.onProgress,
|
||||||
onSuccess: this.onSuccess,
|
onSuccess: this.onSuccess,
|
||||||
});
|
});
|
||||||
|
let uploadList;
|
||||||
|
if (this.props.uploadList) {
|
||||||
|
uploadList = <UploadList items={this.state.fileList} onRemove={this.handleManualRemove} />;
|
||||||
|
}
|
||||||
if (type === 'drag') {
|
if (type === 'drag') {
|
||||||
let dragUploadingClass = '';
|
let dragUploadingClass = '';
|
||||||
let fileList = this.state.fileList;
|
let fileList = this.state.fileList;
|
||||||
@ -206,8 +211,7 @@ const AntUpload = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
</Upload>
|
</Upload>
|
||||||
</div>
|
</div>
|
||||||
<UploadList items={this.state.fileList}
|
{ uploadList }
|
||||||
onRemove={this.handleManualRemove} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (type === 'select') {
|
} else if (type === 'select') {
|
||||||
@ -218,8 +222,7 @@ const AntUpload = React.createClass({
|
|||||||
{this.props.children}
|
{this.props.children}
|
||||||
</Upload>
|
</Upload>
|
||||||
</div>
|
</div>
|
||||||
<UploadList items={this.state.fileList}
|
{ uploadList }
|
||||||
onRemove={this.handleManualRemove} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
| name | 可选参数, 上传的文件 | String | file |
|
| name | 可选参数, 上传的文件 | String | file |
|
||||||
| action | 必选参数, 上传的地址 | String | 无 |
|
| action | 必选参数, 上传的地址 | String | 无 |
|
||||||
| data | 可选参数, 上传所需参数 | Object | 无 |
|
| data | 可选参数, 上传所需参数 | Object | 无 |
|
||||||
|
| uploadList | 可选参数, 是否开启uploadList, 默认开启 | Boolean | true |
|
||||||
| multiple | 可选参数, 是否支持多选文件,支持 `ie10+` | Boolean | false |
|
| multiple | 可选参数, 是否支持多选文件,支持 `ie10+` | Boolean | false |
|
||||||
| accept | 可选参数, 接受上传的文件类型, 详见 input accept Attribute | String | 无 |
|
| accept | 可选参数, 接受上传的文件类型, 详见 input accept Attribute | String | 无 |
|
||||||
| onChange | 可选参数, 上传文件改变时的状态,详见 onChange | Function | 无 |
|
| onChange | 可选参数, 上传文件改变时的状态,详见 onChange | Function | 无 |
|
||||||
|
|
||||||
|
|
||||||
### onChange
|
### onChange
|
||||||
|
|
||||||
文件状态改变的回调,返回为:
|
文件状态改变的回调,返回为:
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.@{upload-prefix-cls}-drag-uploading {
|
&.@{upload-prefix-cls}-drag-uploading {
|
||||||
border-color: tint(@primary-color, 30%);
|
border-color: tint(@primary-color, 20%);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.@{upload-prefix-cls}-drag-icon {
|
p.@{upload-prefix-cls}-drag-icon {
|
||||||
@ -81,7 +81,7 @@
|
|||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
color: #999;
|
color: #999;
|
||||||
:hover {
|
:hover {
|
||||||
background-color: tint(@primary-color, 80%);
|
background-color: tint(@primary-color, 90%);
|
||||||
.anticon.anticon-cross {
|
.anticon.anticon-cross {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user