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
|
2022-05-23 14:37:16 +08:00
|
|
|
|
import { Alert, Spin, Switch } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
|
import React, { useState } from 'react';
|
2015-10-31 02:00:03 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
const App: React.FC = () => {
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
const toggle = (checked: boolean) => {
|
|
|
|
|
setLoading(checked);
|
2019-05-07 14:57:32 +08:00
|
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Spin spinning={loading}>
|
|
|
|
|
<Alert
|
|
|
|
|
message="Alert message title"
|
|
|
|
|
description="Further details about the context of this alert."
|
|
|
|
|
type="info"
|
|
|
|
|
/>
|
|
|
|
|
</Spin>
|
|
|
|
|
<div style={{ marginTop: 16 }}>
|
|
|
|
|
Loading state:
|
|
|
|
|
<Switch checked={loading} onChange={toggle} />
|
2016-01-07 16:29:12 +08:00
|
|
|
|
</div>
|
2022-05-19 09:46:26 +08:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
2015-10-31 02:00:03 +08:00
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
|
```
|