Browse Source

update badge anim

pull/565/head
jljsj 9 years ago
parent
commit
75d2d21b0b
  1. 5
      components/badge/demo/change.md
  2. 2
      components/badge/index.jsx
  3. 11
      components/badge/utils.js

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

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

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

Loading…
Cancel
Save