${title}
${(data[0].value * 10).toFixed(2)}%
= | React.ClassicComponentClass
; function computeHeight(node: HTMLDivElement) { - node.style.height = '100%'; + const { style } = node; + style.height = '100%'; const totalHeight = parseInt(`${getComputedStyle(node).height}`, 10); const padding = parseInt(`${getComputedStyle(node).paddingTop}`, 10) + @@ -14,7 +15,7 @@ function computeHeight(node: HTMLDivElement) { return totalHeight - padding; } -function getAutoHeight(n: HTMLDivElement) { +function getAutoHeight(n: HTMLDivElement | undefined) { if (!n) { return 0; } @@ -30,26 +31,25 @@ function getAutoHeight(n: HTMLDivElement) { return height; } -interface IAutoHeightProps { +interface AutoHeightProps { height?: number; } function autoHeight() { - return function
( + return
( WrappedComponent: React.ComponentClass
| React.SFC
, - ): React.ComponentClass
{ - class AutoHeightComponent extends React.Component
{ + ): React.ComponentClass
=> { + class AutoHeightComponent extends React.Component
{
state = {
computedHeight: 0,
};
- root!: HTMLDivElement;
+ root: HTMLDivElement | undefined = undefined;
componentDidMount() {
const { height } = this.props;
if (!height) {
let h = getAutoHeight(this.root);
- // eslint-disable-next-line
this.setState({ computedHeight: h });
if (h < 1) {
h = getAutoHeight(this.root);
diff --git a/DashboardAnalysis/src/components/IntroduceRow.tsx b/DashboardAnalysis/src/components/IntroduceRow.tsx
index 99371e0274959cd67351b03e89b3c402479e2954..8057b6c80e1ca1e8ed9cad04a23a3d1690a80d5b 100644
--- a/DashboardAnalysis/src/components/IntroduceRow.tsx
+++ b/DashboardAnalysis/src/components/IntroduceRow.tsx
@@ -3,14 +3,12 @@ import { Col, Icon, Row, Tooltip } from 'antd';
import { FormattedMessage } from 'umi-plugin-react/locale';
import React from 'react';
import numeral from 'numeral';
-import Charts from './Charts';
-import { IVisitData } from '../data.d';
+import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from './Charts';
+import { VisitDataType } from '../data.d';
import Trend from './Trend';
import Yuan from '../utils/Yuan';
import styles from '../style.less';
-const { ChartCard, MiniArea, MiniBar, MiniProgress, Field } = Charts;
-
const topColResponsiveProps = {
xs: 24,
sm: 12,
@@ -20,7 +18,7 @@ const topColResponsiveProps = {
style: { marginBottom: 24 },
};
-const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: IVisitData[] }) => (
+const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: VisitDataType[] }) => (