Image 添加错误显式

This commit is contained in:
liaoxuezhi 2019-10-22 14:57:53 +08:00
parent 04bfe4c188
commit bd4a2b3242
2 changed files with 9 additions and 2 deletions

View File

@ -169,6 +169,11 @@
margin: 10px 0 0;
}
}
&-errorMsg {
color: $danger;
margin: 5px 0 0;
}
}

View File

@ -842,10 +842,10 @@ export default class ImageControl extends React.Component<ImageProps, ImageState
key={file.id || key}
className={cx('ImageControl-item', {
'is-uploaded': file.state !== 'uploading',
'is-invalid': file.state === 'error' || file.state == 'invalid'
'is-invalid': file.state === 'error' || file.state === 'invalid'
})}
>
{file.error ? (
{file.state === 'invalid' || file.state === 'error' ? (
<a
className={cx('ImageControl-retryBtn', {'is-disabled': disabled})}
onClick={this.handleSelect}
@ -959,6 +959,8 @@ export default class ImageControl extends React.Component<ImageProps, ImageState
{uploading ? '暂停上传' : '开始上传'}
</button>
) : null}
{error ? <div className={cx('ImageControl-errorMsg')}>{error}</div> : null}
</div>
);
}