Commit 85869caa authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

fix #2146 Water chart no update

parent 80e2a58f
...@@ -6,7 +6,6 @@ import styles from './index.less'; ...@@ -6,7 +6,6 @@ import styles from './index.less';
/* eslint no-mixed-operators: 0 */ /* eslint no-mixed-operators: 0 */
// riddle: https://riddle.alibaba-inc.com/riddles/2d9a4b90 // riddle: https://riddle.alibaba-inc.com/riddles/2d9a4b90
export default
@autoHeight() @autoHeight()
class WaterWave extends PureComponent { class WaterWave extends PureComponent {
state = { state = {
...@@ -25,6 +24,13 @@ class WaterWave extends PureComponent { ...@@ -25,6 +24,13 @@ class WaterWave extends PureComponent {
); );
} }
componentDidUpdate(props) {
const { percent } = this.props;
if (props.percent !== percent) {
this.renderChart();
}
}
componentWillUnmount() { componentWillUnmount() {
cancelAnimationFrame(this.timer); cancelAnimationFrame(this.timer);
if (this.node) { if (this.node) {
...@@ -203,3 +209,5 @@ class WaterWave extends PureComponent { ...@@ -203,3 +209,5 @@ class WaterWave extends PureComponent {
); );
} }
} }
export default WaterWave;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment