Browse Source

fix danger warning

pull/1427/head
afc163 8 years ago
parent
commit
6481a3afb2
  1. 2
      src/components/Charts/index.js
  2. 18
      src/routes/Dashboard/Analysis.js

2
src/components/Charts/index.js

@ -13,7 +13,7 @@ import WaterWave from './WaterWave';
import TagCloud from './TagCloud';
import TimelineChart from './TimelineChart';
const yuan = val => `¥ ${numeral(val).format('0,0')}`;
const yuan = val => `¥ ${numeral(val).format('0,0')}`;
const Charts = {
yuan,

18
src/routes/Dashboard/Analysis.js

@ -42,6 +42,10 @@ for (let i = 0; i < 7; i += 1) {
});
}
const Yuan = ({ children }) => (
<span dangerouslySetInnerHTML={{ __html: yuan(children) }} /> /* eslint-disable-line react/no-danger */
);
@connect(({ chart, loading }) => ({
chart,
loading: loading.effects['chart/fetch'],
@ -252,7 +256,7 @@ export default class Analysis extends Component {
<Icon type="info-circle-o" />
</Tooltip>
}
total={() => <span dangerouslySetInnerHTML={{ __html: yuan(126560) }} />}
total={() => <Yuan>126560</Yuan>}
footer={<Field label="日均销售额" value={`${numeral(12423).format('0,0')}`} />}
contentHeight={46}
>
@ -451,15 +455,11 @@ export default class Analysis extends Component {
<Pie
hasLegend
subTitle="销售额"
total={() => (
<span
dangerouslySetInnerHTML={{
__html: yuan(salesPieData.reduce((pre, now) => now.y + pre, 0)),
}}
/>
)}
total={
() => <Yuan>{salesPieData.reduce((pre, now) => now.y + pre, 0)}</Yuan>
}
data={salesPieData}
valueFormat={val => <span dangerouslySetInnerHTML={{ __html: yuan(val) }} />}
valueFormat={value => <Yuan>{value}</Yuan>}
height={248}
lineWidth={4}
/>

Loading…
Cancel
Save