refactor(admin): 用已安装的 file-saver/fast-deep-equal 替代手写下载与 JSON 比较
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { lazy, Suspense, useEffect, useMemo, useState } from 'react';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { XCard, registerCatalog, type XAgentCommand_v0_9 } from '@ant-design/x-card';
|
||||
import { Button, Spin, Tag, Tooltip, Typography } from 'antd';
|
||||
import { DownloadOutlined } from '@ant-design/icons';
|
||||
@@ -232,12 +233,7 @@ const ChartPreview: React.FC<ChartPreviewProps> = ({ chart }) => {
|
||||
pixelRatio: 2,
|
||||
backgroundColor: '#fff',
|
||||
});
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = `${chart.title || '图表'}.png`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
saveAs(url, `${chart.title || '图表'}.png`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user