From 75d2d21b0b8ba03a99c130e2d9da1df5409bd1dd Mon Sep 17 00:00:00 2001 From: jljsj Date: Fri, 20 Nov 2015 15:08:17 +0800 Subject: [PATCH] update badge anim --- components/badge/demo/change.md | 5 ++--- components/badge/index.jsx | 2 +- components/badge/utils.js | 11 ++++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/components/badge/demo/change.md b/components/badge/demo/change.md index a023bf5756..1d6f75e706 100644 --- a/components/badge/demo/change.md +++ b/components/badge/demo/change.md @@ -18,11 +18,11 @@ const Test = React.createClass({ }; }, increase() { - const count = this.state.count + 117; + const count = this.state.count + 114; this.setState({ count }); }, decline() { - let count = this.state.count - 111; + let count = this.state.count - 121; if (count < 0) { count = 0; } @@ -40,7 +40,6 @@ const Test = React.createClass({ }); }, render() { - console.log(this.state.count) return
diff --git a/components/badge/index.jsx b/components/badge/index.jsx index 0057221ed8..7d31a37a0c 100644 --- a/components/badge/index.jsx +++ b/components/badge/index.jsx @@ -11,7 +11,7 @@ class AntBadge extends React.Component { let { count, prefixCls } = this.props; const dot = this.props.dot; - count = count >= 100 ? '99+' : count; + //count = count >= 100 ? '99+' : count; // dot mode don't need count if (dot) { diff --git a/components/badge/utils.js b/components/badge/utils.js index c84b44a54a..65546ed488 100644 --- a/components/badge/utils.js +++ b/components/badge/utils.js @@ -37,11 +37,14 @@ export function getTranslateY(count, preCount, data, preData, j, height, _length if (count > preCount) { if (on > to) { translateY = -(oneData - (to - on)) * height; - data[(_length - j) + '_add'] = true; + if (typeof preOn === 'number') { + data[(_length - j) + '_add'] = true; + } } else if (on < to) { translateY = -(oneData + 10 - (to - on)) * height; if (preTo - preOn) { - translateY = -(oneData - (to - on)) * height; + //translateY = -(oneData + 20 - (to - on)) * height; + data[(_length - j) + '_add'] = true; } } else { if (typeof preOn === 'number' && typeof preTo === 'number') { @@ -51,7 +54,9 @@ export function getTranslateY(count, preCount, data, preData, j, height, _length } else if (count < preCount) { if (on < to) { translateY = -(oneData + 20 - ( to - on)) * height; - data[(_length - j) + '_rem'] = true; + if (typeof preTo === 'number') { + data[(_length - j) + '_rem'] = true; + } } else if (on > to) { translateY = -(oneData + 10 - (to - on)) * height; if (preOn - preTo) {