Browse Source

feat add uploadlist config and fix color

pull/459/head
xiaosheng.lj 9 years ago
parent
commit
9cb8bef1ad
  1. 1
      components/upload/demo/drag-simple.md
  2. 1
      components/upload/demo/drag.md
  3. 11
      components/upload/index.jsx
  4. 2
      components/upload/index.md
  5. 4
      style/components/upload.less

1
components/upload/demo/drag-simple.md

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

1
components/upload/demo/drag.md

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

11
components/upload/index.jsx

@ -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>
); );
} }

2
components/upload/index.md

@ -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
文件状态改变的回调,返回为: 文件状态改变的回调,返回为:

4
style/components/upload.less

@ -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…
Cancel
Save