Browse Source

spining backward support

pull/1606/head
RaoHai 9 years ago
parent
commit
1547dc5e31
  1. 2
      components/spin/demo/nested.md
  2. 15
      components/spin/index.jsx

2
components/spin/demo/nested.md

@ -27,7 +27,7 @@ const Card = React.createClass({
);
return (
<div>
<Spin spinning={this.state.loading}>{container}</Spin>
<Spin spining={this.state.loading}>{container}</Spin>
切换加载状态:<Switch checked={this.state.loading} onChange={this.toggle} />
</div>
);

15
components/spin/index.jsx

@ -12,8 +12,7 @@ export default class Spin extends React.Component {
constructor(props) {
super(props);
const { spining } = props;
const spinning = props.spinning && spining;
const spinning = this.getSpinning(props);
this.state = {
spinning,
};
@ -34,9 +33,17 @@ export default class Spin extends React.Component {
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
}
}
getSpinning(props) {
warning(!('spining' in this.props), '`spining` property of Popover is a spell mistake, use `spinning` instead.');
const { spinning, spining } = props;
// Backwards support
if (spining !== undefined) {
return spining;
}
return spinning;
}
componentWillReceiveProps(nextProps) {
const { spining = true } = nextProps;
const spinning = nextProps.spinning && spining; // Backwards support
const spinning = this.getSpinning(nextProps);
if (this.debounceTimeout) {
clearTimeout(this.debounceTimeout);
}

Loading…
Cancel
Save