2016-03-31 09:40:55 +08:00
|
|
|
|
---
|
|
|
|
|
order: 3
|
2016-09-20 14:51:43 +08:00
|
|
|
|
title:
|
2016-07-21 09:51:04 +08:00
|
|
|
|
zh-CN: 卡片加载中
|
|
|
|
|
en-US: Embedded mode
|
2016-03-31 09:40:55 +08:00
|
|
|
|
---
|
2015-10-31 02:00:03 +08:00
|
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
|
## zh-CN
|
|
|
|
|
|
2015-10-31 02:00:03 +08:00
|
|
|
|
可以直接把内容内嵌到 `Spin` 中,将现有容器变为加载状态。
|
|
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
|
## en-US
|
|
|
|
|
|
2019-04-19 22:38:41 +08:00
|
|
|
|
Embedding content into `Spin` will set it into loading state.
|
2016-07-21 09:51:04 +08:00
|
|
|
|
|
2022-04-08 22:55:42 +08:00
|
|
|
|
```tsx
|
2015-11-03 22:41:57 +08:00
|
|
|
|
import { Spin, Switch, Alert } from 'antd';
|
2015-10-31 02:00:03 +08:00
|
|
|
|
|
2017-02-20 22:16:57 +08:00
|
|
|
|
class Card extends React.Component {
|
2019-05-07 14:57:32 +08:00
|
|
|
|
state = { loading: false };
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2022-04-08 22:55:42 +08:00
|
|
|
|
toggle = (value: boolean) => {
|
2016-05-09 16:11:54 +08:00
|
|
|
|
this.setState({ loading: value });
|
2019-05-07 14:57:32 +08:00
|
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2017-06-14 13:48:00 +08:00
|
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
|
return (
|
|
|
|
|
<div>
|
2017-06-14 13:31:21 +08:00
|
|
|
|
<Spin spinning={this.state.loading}>
|
|
|
|
|
<Alert
|
|
|
|
|
message="Alert message title"
|
|
|
|
|
description="Further details about the context of this alert."
|
|
|
|
|
type="info"
|
|
|
|
|
/>
|
|
|
|
|
</Spin>
|
|
|
|
|
<div style={{ marginTop: 16 }}>
|
2019-05-07 14:57:32 +08:00
|
|
|
|
Loading state:
|
|
|
|
|
<Switch checked={this.state.loading} onChange={this.toggle} />
|
2017-06-14 13:31:21 +08:00
|
|
|
|
</div>
|
2016-01-07 16:29:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
);
|
2017-02-20 22:16:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-31 02:00:03 +08:00
|
|
|
|
|
2022-04-03 23:27:45 +08:00
|
|
|
|
export default () => <Card />;
|
2019-05-07 14:57:32 +08:00
|
|
|
|
```
|