You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.4 KiB

---
order: 5
title:
zh-CN: 预加载的卡片
en-US: Loading card
---
9 years ago
## zh-CN
9 years ago
数据读入前会有文本块样式。
## en-US
Shows a loading indicator while the contents of the card is being fetched.
````jsx
import { Skeleton, Switch, Card, Icon, Avatar } from 'antd';
const { Meta } = Card;
class App extends React.Component {
state = {
loading: true,
}
onChange = (checked) => {
this.setState({ loading: !checked });
}
render() {
const { loading } = this.state;
return (
<div>
<Switch checked={!loading} onChange={this.onChange} />
<Card style={{ width: 300, marginTop: 16 }} loading={loading}>
<Meta
avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
title="Card title"
description="This is the description"
/>
</Card>
<Card
style={{ width: 300, marginTop: 16 }}
actions={[<Icon type="setting" />, <Icon type="edit" />, <Icon type="ellipsis" />]}
>
<Skeleton loading={loading} avatar active>
<Meta
avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
title="Card title"
description="This is the description"
/>
</Skeleton>
</Card>
</div>
);
}
}
9 years ago
ReactDOM.render(<App />, mountNode);
9 years ago
````