update badge anim

This commit is contained in:
jljsj 2015-11-20 15:08:17 +08:00
parent de13164330
commit 75d2d21b0b
3 changed files with 11 additions and 7 deletions

View File

@ -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 <div>
<Badge count={this.state.count}>
<a href="#" className="head-example"></a>

View File

@ -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) {

View File

@ -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) {