feat add uploadlist config and fix color

This commit is contained in:
xiaosheng.lj 2015-11-03 15:06:30 +08:00
parent 440f69a800
commit 9cb8bef1ad
5 changed files with 13 additions and 6 deletions

View File

@ -12,6 +12,7 @@ const Dragger = Upload.Dragger;
const props = {
name: 'file',
uploadList: false,
action: '/upload.do'
};

View File

@ -12,6 +12,7 @@ const Dragger = Upload.Dragger;
const props = {
name: 'file',
uploadList: false,
action: '/upload.do'
};

View File

@ -168,6 +168,7 @@ const AntUpload = React.createClass({
data: {},
accept: '',
onChange: noop,
uploadList: true
};
},
componentWillReceiveProps(nextProps) {
@ -188,6 +189,10 @@ const AntUpload = React.createClass({
onProgress: this.onProgress,
onSuccess: this.onSuccess,
});
let uploadList;
if (this.props.uploadList) {
uploadList = <UploadList items={this.state.fileList} onRemove={this.handleManualRemove} />;
}
if (type === 'drag') {
let dragUploadingClass = '';
let fileList = this.state.fileList;
@ -206,8 +211,7 @@ const AntUpload = React.createClass({
</div>
</Upload>
</div>
<UploadList items={this.state.fileList}
onRemove={this.handleManualRemove} />
{ uploadList }
</div>
);
} else if (type === 'select') {
@ -218,8 +222,7 @@ const AntUpload = React.createClass({
{this.props.children}
</Upload>
</div>
<UploadList items={this.state.fileList}
onRemove={this.handleManualRemove} />
{ uploadList }
</div>
);
}

View File

@ -23,10 +23,12 @@
| name | 可选参数, 上传的文件 | String | file |
| action | 必选参数, 上传的地址 | String | 无 |
| data | 可选参数, 上传所需参数 | Object | 无 |
| uploadList | 可选参数, 是否开启uploadList, 默认开启 | Boolean | true |
| multiple | 可选参数, 是否支持多选文件,支持 `ie10+` | Boolean | false |
| accept | 可选参数, 接受上传的文件类型, 详见 input accept Attribute | String | 无 |
| onChange | 可选参数, 上传文件改变时的状态,详见 onChange | Function | 无 |
### onChange
文件状态改变的回调,返回为:

View File

@ -40,7 +40,7 @@
}
&.@{upload-prefix-cls}-drag-uploading {
border-color: tint(@primary-color, 30%);
border-color: tint(@primary-color, 20%);
}
p.@{upload-prefix-cls}-drag-icon {
@ -81,7 +81,7 @@
margin-top: 8px;
color: #999;
:hover {
background-color: tint(@primary-color, 80%);
background-color: tint(@primary-color, 90%);
.anticon.anticon-cross {
display: inline-block;
}