2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 4
|
|
|
|
title: 加载中
|
|
|
|
---
|
2015-06-17 21:29:58 +08:00
|
|
|
|
2015-12-28 13:57:02 +08:00
|
|
|
添加 `loading` 属性即可让按钮处于加载状态,最后两个按钮演示点击后进入加载状态。
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-07-29 22:23:55 +08:00
|
|
|
````jsx
|
2016-04-12 12:17:03 +08:00
|
|
|
import { Button } from 'antd';
|
2015-09-27 16:30:35 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const App = React.createClass({
|
2015-07-29 22:23:55 +08:00
|
|
|
getInitialState() {
|
|
|
|
return {
|
2015-12-28 13:49:58 +08:00
|
|
|
loading: false,
|
|
|
|
iconLoading: false,
|
2015-07-29 22:23:55 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
enterLoading() {
|
2015-12-28 13:49:58 +08:00
|
|
|
this.setState({ loading: true });
|
|
|
|
},
|
|
|
|
enterIconLoading() {
|
|
|
|
this.setState({ iconLoading: true });
|
2015-07-29 22:23:55 +08:00
|
|
|
},
|
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Button type="primary" size="large" loading>
|
|
|
|
加载中
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" loading>
|
|
|
|
加载中
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" size="small" loading>
|
|
|
|
加载中
|
|
|
|
</Button>
|
|
|
|
<br />
|
|
|
|
<Button type="primary" loading={this.state.loading} onClick={this.enterLoading}>
|
|
|
|
点击变加载
|
|
|
|
</Button>
|
2016-04-12 12:17:03 +08:00
|
|
|
<Button type="primary" icon="poweroff" loading={this.state.iconLoading} onClick={this.enterIconLoading}>
|
|
|
|
点击变加载
|
2016-01-07 16:29:12 +08:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
);
|
2015-07-29 22:23:55 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<App />, mountNode);
|
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>
|