From 85869caa89e0a9d188ddcd10860ec6efa3fe4444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 4 Sep 2018 11:51:04 +0800 Subject: [PATCH] fix #2146 Water chart no update --- src/components/Charts/WaterWave/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index 0fd61a95..450b31ff 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/src/components/Charts/WaterWave/index.js @@ -6,7 +6,6 @@ import styles from './index.less'; /* eslint no-mixed-operators: 0 */ // riddle: https://riddle.alibaba-inc.com/riddles/2d9a4b90 -export default @autoHeight() class WaterWave extends PureComponent { state = { @@ -25,6 +24,13 @@ class WaterWave extends PureComponent { ); } + componentDidUpdate(props) { + const { percent } = this.props; + if (props.percent !== percent) { + this.renderChart(); + } + } + componentWillUnmount() { cancelAnimationFrame(this.timer); if (this.node) { @@ -203,3 +209,5 @@ class WaterWave extends PureComponent { ); } } + +export default WaterWave; -- GitLab