Commit 75eb9ff1 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 9199f48f f10e5bcd
......@@ -179,6 +179,7 @@ export interface IUploaderProps {
value: any[]
listType?: UploadListType
readOnly?: boolean
maxCount?: number
}
export const Upload = connect({
......@@ -274,7 +275,7 @@ export const Upload = connect({
public render() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { listType, locale, onChange, value = [], ...others } = this.props
if (listType.indexOf('card') > -1) {
if (listType!.indexOf('card') > -1) {
return (
<AntdUpload
{...others}
......@@ -283,13 +284,13 @@ export const Upload = connect({
onRemove={this.onRemoveHandler}
listType={'picture-card'}
>
{!others.readOnly ? (
{!others.readOnly && (others.maxCount !== undefined ? this.state.value.length < others.maxCount : true) ? (
<UploadPlaceholder />
) : null}
</AntdUpload>
)
}
if (listType.indexOf('dragger') > -1) {
if (listType!.indexOf('dragger') > -1) {
return (
<UploadDragger
{...others}
......@@ -297,7 +298,7 @@ export const Upload = connect({
onChange={this.onChangeHandler}
onRemove={this.onRemoveHandler}
// TODO image 类型是跟 picture 一样 ?
listType={listType.indexOf('image') > -1 ? 'picture' : 'text'}
listType={listType!.indexOf('image') > -1 ? 'picture' : 'text'}
>
<p className={'ant-upload-drag-icon'}>
<InboxOutlined />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment