fix for onPreview works only when file.url existed

close #2163
This commit is contained in:
afc163 2016-06-24 13:35:11 +08:00
parent 37cf2a3d5e
commit dc191a321b

View File

@ -100,23 +100,31 @@ export default class UploadList extends React.Component {
file.url
? (
<a
onClick={(e) => this.handlePreview(file, e)}
href={file.url} target="_blank"
href={file.url}
target="_blank"
className={`${prefixCls}-list-item-name`}
onClick={e => this.handlePreview(file, e)}
>
{file.name}
</a>
) : <span className={`${prefixCls}-list-item-name`}>{file.name}</span>
) : (
<span
className={`${prefixCls}-list-item-name`}
onClick={e => this.handlePreview(file, e)}
>
{file.name}
</span>
)
}
{
this.props.listType === 'picture-card' && file.status !== 'uploading'
? (
<span>
<a
onClick={(e) => this.handlePreview(file, e)}
href={file.url}
target="_blank"
style={{ pointerEvents: file.url ? '' : 'none' }}
onClick={e => this.handlePreview(file, e)}
>
<Icon type="eye-o" />
</a>