2015-06-17 21:29:58 +08:00
|
|
|
# 加载中
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-06-17 21:29:58 +08:00
|
|
|
- order: 7
|
|
|
|
|
2015-07-29 22:23:55 +08:00
|
|
|
加载按钮。最后一个按钮演示点击后进入加载状态。
|
2015-06-05 20:26:41 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2015-07-29 22:23:55 +08:00
|
|
|
````jsx
|
|
|
|
var App = React.createClass({
|
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
loading: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
enterLoading() {
|
|
|
|
this.setState({
|
|
|
|
loading: true
|
|
|
|
});
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
var loadingClass = this.state.loading ? 'ant-btn-loading' : '';
|
|
|
|
return <div>
|
|
|
|
<button className="ant-btn ant-btn-primary ant-btn-lg ant-btn-loading">
|
|
|
|
加载中
|
|
|
|
</button>
|
|
|
|
<button className="ant-btn ant-btn-primary ant-btn-loading">
|
|
|
|
加载中
|
|
|
|
</button>
|
|
|
|
<button className="ant-btn ant-btn-primary ant-btn-sm ant-btn-loading">
|
|
|
|
加载中
|
|
|
|
</button>
|
|
|
|
<br />
|
|
|
|
<button className={'ant-btn ant-btn-primary ' + loadingClass} onClick={this.enterLoading}>
|
|
|
|
点击变加载
|
|
|
|
</button>
|
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
React.render(<App />, document.getElementById('components-button-demo-loading'));
|
2015-06-05 20:26:41 +08:00
|
|
|
````
|
2015-07-29 22:23:55 +08:00
|
|
|
|
|
|
|
<style>
|
|
|
|
#components-button-demo-loading .ant-btn {
|
|
|
|
margin-right: 8px;
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
</style>
|