mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
improve preview icon display logic, #3644
This commit is contained in:
parent
57f5d299af
commit
e62dc08d2c
@ -37,11 +37,10 @@ const ImageUploadList = React.createClass({
|
||||
name: 'xxx.png',
|
||||
status: 'done',
|
||||
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
||||
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
||||
}],
|
||||
onPreview: (file) => {
|
||||
this.setState({
|
||||
previewImage: file.url,
|
||||
previewImage: file.url || file.thumbUrl,
|
||||
previewVisible: true,
|
||||
});
|
||||
},
|
||||
|
@ -80,10 +80,10 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
||||
<a
|
||||
className={`${prefixCls}-list-item-thumbnail`}
|
||||
onClick={e => this.handlePreview(file, e)}
|
||||
href={file.thumbUrl || file.url}
|
||||
href={file.url || file.thumbUrl}
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
<img src={file.thumbUrl || file.url} alt={file.name} />
|
||||
<img src={file.url || file.thumbUrl} alt={file.name} />
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@ -129,9 +129,13 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
||||
? (
|
||||
<span>
|
||||
<a
|
||||
href={file.url}
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
style={{ pointerEvents: file.url || file.thumbUrl ? '' : 'none' }}
|
||||
href={file.url || file.thumbUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
style={(file.url || file.thumbUrl) ? undefined : {
|
||||
pointerEvents: 'none',
|
||||
opacity: 0.5,
|
||||
}}
|
||||
onClick={e => this.handlePreview(file, e)}
|
||||
>
|
||||
<Icon type="eye-o" />
|
||||
|
Loading…
Reference in New Issue
Block a user