diff --git a/src/components/Charts/ChartCard/index.js b/src/components/Charts/ChartCard/index.js index db2c4623fa3fb99201b09a283d3cdf5b16385f6a..2fd10e6f1ac4ba2c02129d8c2ae2f7e7e892c022 100644 --- a/src/components/Charts/ChartCard/index.js +++ b/src/components/Charts/ChartCard/index.js @@ -4,6 +4,21 @@ import classNames from 'classnames'; import styles from './index.less'; +const renderTotal = (total) => { + let totalDom; + switch (typeof total) { + case undefined: + totalDom = null; + break; + case 'string': + totalDom =
; + break; + default: + totalDom =
{total}
; + } + return totalDom; +}; + const ChartCard = ({ loading = false, contentHeight, title, avatar, action, total, footer, children, ...rest }) => { @@ -22,10 +37,7 @@ const ChartCard = ({ {title} {action}
- { - // eslint-disable-next-line - (total !== undefined) && (
) - } + {renderTotal(total)}
{