提交 6481a3af 编写于 作者: A afc163

fix danger warning

上级 df0ffd6d
......@@ -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,
......
......@@ -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}
/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册