fix(upload-component): open attachment link in new tab

This commit is contained in:
chenos 2022-11-24 15:38:43 +08:00
parent 71120ab3c4
commit 70afa8c7e2

View File

@ -28,15 +28,16 @@ ReadPretty.Attachment = (props: UploadProps) => {
<div className={'ant-upload-list ant-upload-list-picture-card'}> <div className={'ant-upload-list ant-upload-list-picture-card'}>
{images.map((file) => { {images.map((file) => {
const handleClick = (e) => { const handleClick = (e) => {
e.preventDefault();
e.stopPropagation();
const index = images.indexOf(file); const index = images.indexOf(file);
if (isImage(file.extname)) { if (isImage(file.extname)) {
e.preventDefault();
e.stopPropagation();
setVisible(true); setVisible(true);
setPhotoIndex(index); setPhotoIndex(index);
} else {
saveAs(file.url, `${file.title}${file.extname}`);
} }
// else {
// saveAs(file.url, `${file.title}${file.extname}`);
// }
}; };
return ( return (
<div className={'ant-upload-list-picture-card-container'}> <div className={'ant-upload-list-picture-card-container'}>