|
@@ -4,6 +4,8 @@ import { memo } from 'react';
|
|
|
|
|
|
const FileViewerModal = ({ data, visible, onCancel, downloadFile }) => {
|
|
const FileViewerModal = ({ data, visible, onCancel, downloadFile }) => {
|
|
const type = data?.url?.split('.')[data?.url?.split('.').length - 1];
|
|
const type = data?.url?.split('.')[data?.url?.split('.').length - 1];
|
|
|
|
+ console.log(data?.url, type);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
destroyOnClose
|
|
destroyOnClose
|
|
@@ -18,8 +20,9 @@ const FileViewerModal = ({ data, visible, onCancel, downloadFile }) => {
|
|
key={data?.name}
|
|
key={data?.name}
|
|
fileType={type}
|
|
fileType={type}
|
|
filePath={data?.url}
|
|
filePath={data?.url}
|
|
- onError={() => downloadFile(data)}
|
|
|
|
- errorComponent={console.log('出现错误')}
|
|
|
|
|
|
+ // onError={() => downloadFile(data)}
|
|
|
|
+ onError={e => console.error(e)}
|
|
|
|
+ errorComponent={<div>文件加载错误</div>}
|
|
unsupportedComponent={<div>不支持的文件格式</div>}
|
|
unsupportedComponent={<div>不支持的文件格式</div>}
|
|
/>
|
|
/>
|
|
</Modal>
|
|
</Modal>
|