|
@ -17,27 +17,29 @@ The count will be animated as it changes. |
|
|
import { Badge, Button, Icon, Switch } from 'antd'; |
|
|
import { Badge, Button, Icon, Switch } from 'antd'; |
|
|
const ButtonGroup = Button.Group; |
|
|
const ButtonGroup = Button.Group; |
|
|
|
|
|
|
|
|
const Test = React.createClass({ |
|
|
class Demo extends React.Component { |
|
|
getInitialState() { |
|
|
state = { |
|
|
return { |
|
|
count: 5, |
|
|
count: 5, |
|
|
show: true, |
|
|
show: true, |
|
|
} |
|
|
}; |
|
|
|
|
|
}, |
|
|
increase = () => { |
|
|
increase() { |
|
|
|
|
|
const count = this.state.count + 1; |
|
|
const count = this.state.count + 1; |
|
|
this.setState({ count }); |
|
|
this.setState({ count }); |
|
|
}, |
|
|
} |
|
|
decline() { |
|
|
|
|
|
|
|
|
decline = () => { |
|
|
let count = this.state.count - 1; |
|
|
let count = this.state.count - 1; |
|
|
if (count < 0) { |
|
|
if (count < 0) { |
|
|
count = 0; |
|
|
count = 0; |
|
|
} |
|
|
} |
|
|
this.setState({ count }); |
|
|
this.setState({ count }); |
|
|
}, |
|
|
} |
|
|
onChange(show) { |
|
|
|
|
|
|
|
|
onChange = (show) => { |
|
|
this.setState({ show }); |
|
|
this.setState({ show }); |
|
|
}, |
|
|
} |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
return ( |
|
|
return ( |
|
|
<div> |
|
|
<div> |
|
@ -62,8 +64,8 @@ const Test = React.createClass({ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
); |
|
|
); |
|
|
}, |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
ReactDOM.render(<Test />, mountNode); |
|
|
ReactDOM.render(<Demo />, mountNode); |
|
|
```` |
|
|
```` |
|
|