improve code style

This commit is contained in:
afc163 2016-05-09 16:20:46 +08:00
parent 74975a801a
commit e7e1f52648

View File

@ -33,15 +33,16 @@ export default class Spin extends React.Component {
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`; findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
} }
} }
getSpinning(props) { getSpinning(props) {
warning(!('spining' in this.props), '`spining` property of Spin is a spell mistake, use `spinning` instead.');
const { spinning, spining } = props;
// Backwards support // Backwards support
if (spining !== undefined) { if ('spining' in props) {
return spining; warning(false, '`spining` property of Spin is a spell mistake, use `spinning` instead.');
return props.spining;
} }
return spinning; return props.spinning;
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const spinning = this.getSpinning(nextProps); const spinning = this.getSpinning(nextProps);
if (this.debounceTimeout) { if (this.debounceTimeout) {
@ -53,6 +54,7 @@ export default class Spin extends React.Component {
this.setState({ spinning }); this.setState({ spinning });
} }
} }
render() { render() {
const { className, size, prefixCls, tip } = this.props; const { className, size, prefixCls, tip } = this.props;
const { spinning } = this.state; const { spinning } = this.state;