|
|
@@ -1,17 +1,28 @@
|
|
|
+import React, { Suspense } from 'react';
|
|
|
import numeral from 'numeral';
|
|
|
-import './g2';
|
|
|
import ChartCard from './ChartCard';
|
|
|
-import Bar from './Bar';
|
|
|
-import Pie from './Pie';
|
|
|
-import Radar from './Radar';
|
|
|
-import Gauge from './Gauge';
|
|
|
-import MiniArea from './MiniArea';
|
|
|
-import MiniBar from './MiniBar';
|
|
|
-import MiniProgress from './MiniProgress';
|
|
|
-import Field from './Field';
|
|
|
-import WaterWave from './WaterWave';
|
|
|
-import TagCloud from './TagCloud';
|
|
|
-import TimelineChart from './TimelineChart';
|
|
|
+
|
|
|
+const getComponent = Component => {
|
|
|
+ return props => {
|
|
|
+ return (
|
|
|
+ <Suspense fallback={null}>
|
|
|
+ <Component {...props} />
|
|
|
+ </Suspense>
|
|
|
+ );
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+const Bar = getComponent(React.lazy(() => import('./Bar')));
|
|
|
+const Pie = getComponent(React.lazy(() => import('./Pie')));
|
|
|
+const Radar = getComponent(React.lazy(() => import('./Radar')));
|
|
|
+const Gauge = getComponent(React.lazy(() => import('./Gauge')));
|
|
|
+const MiniArea = getComponent(React.lazy(() => import('./MiniArea')));
|
|
|
+const MiniBar = getComponent(React.lazy(() => import('./MiniBar')));
|
|
|
+const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress')));
|
|
|
+const Field = getComponent(React.lazy(() => import('./Field')));
|
|
|
+const WaterWave = getComponent(React.lazy(() => import('./WaterWave')));
|
|
|
+const TagCloud = getComponent(React.lazy(() => import('./TagCloud')));
|
|
|
+const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart')));
|
|
|
|
|
|
const yuan = val => `¥ ${numeral(val).format('0,0')}`;
|
|
|
|