| | |
| | | |
| | | class FileUpload extends Component { |
| | | static propTpyes = { |
| | | value: PropTypes.array // 按钮信息、表单列表 |
| | | value: PropTypes.array, // 按钮信息、表单列表 |
| | | maxFile: PropTypes.any, // 最大文件数 |
| | | fileType: PropTypes.string // 文件显示类型 |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { value } = this.props |
| | | const { value, maxFile, fileType } = this.props |
| | | const { showprogress, percent, baseUrl } = this.state |
| | | |
| | | let uploadable = '' |
| | | |
| | | if (maxFile && maxFile > 0 && value && value.length >= maxFile) { |
| | | uploadable = 'limit-fileupload' |
| | | } |
| | | |
| | | const props = { |
| | | name: 'file', |
| | | disabled: showprogress, |
| | | listType: fileType, |
| | | fileList: value, |
| | | action: baseUrl, |
| | | method: 'post', |
| | |
| | | onRemove: this.onRemove, |
| | | data: this.getExtraData, |
| | | beforeUpload: this.beforeUpload, |
| | | className: uploadable |
| | | } |
| | | |
| | | return ( |
| | | <Upload {...props}> |
| | | <Button> |