|
@@ -2,7 +2,7 @@ import FileViewer from 'react-file-viewer';
|
|
|
import { Modal, Spin } from 'antd';
|
|
|
import { memo } from 'react';
|
|
|
|
|
|
-const FileViewerModal = ({ data, visible, onCancel }) => {
|
|
|
+const FileViewerModal = ({ data, visible, onCancel, downloadFile }) => {
|
|
|
const type = data?.url?.split('.')[data?.url?.split('.').length - 1];
|
|
|
console.log(data?.url, type);
|
|
|
return (
|
|
@@ -18,9 +18,9 @@ const FileViewerModal = ({ data, visible, onCancel }) => {
|
|
|
key={data?.name}
|
|
|
fileType={type}
|
|
|
filePath={data?.url}
|
|
|
- onError={() => console.log('Failed to load')}
|
|
|
+ onError={() => downloadFile(data)}
|
|
|
errorComponent={console.log('出现错误')}
|
|
|
- unsupportedComponent={console.log('不支持')}
|
|
|
+ unsupportedComponent={<div>不支持的文件格式</div>}
|
|
|
/>
|
|
|
</Modal>
|
|
|
);
|