mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
61 lines
1.1 KiB
Markdown
61 lines
1.1 KiB
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 包含子组件
|
|
en-US: Contains sub component
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
加载占位图包含子组件。
|
|
|
|
## en-US
|
|
|
|
Skeleton contains sub component.
|
|
|
|
```tsx
|
|
import { Button, Skeleton } from 'antd';
|
|
import React, { useState } from 'react';
|
|
|
|
const App: React.FC = () => {
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const showSkeleton = () => {
|
|
setLoading(true);
|
|
|
|
setTimeout(() => {
|
|
setLoading(false);
|
|
}, 3000);
|
|
};
|
|
|
|
return (
|
|
<div className="article">
|
|
<Skeleton loading={loading}>
|
|
<div>
|
|
<h4>Ant Design, a design language</h4>
|
|
<p>
|
|
We supply a series of design principles, practical patterns and high quality design
|
|
resources (Sketch and Axure), to help people create their product prototypes beautifully
|
|
and efficiently.
|
|
</p>
|
|
</div>
|
|
</Skeleton>
|
|
<Button onClick={showSkeleton} disabled={loading}>
|
|
Show Skeleton
|
|
</Button>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
```
|
|
|
|
<style>
|
|
.article h4 {
|
|
margin-bottom: 16px;
|
|
}
|
|
.article button {
|
|
margin-top: 16px;
|
|
}
|
|
</style>
|