2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-04-10 15:38:52 +08:00
|
|
|
order: 5
|
2016-05-26 17:46:55 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 预加载的卡片
|
|
|
|
en-US: Loading card
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-02-22 16:25:13 +08:00
|
|
|
|
2016-05-26 17:46:55 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-02-22 16:25:13 +08:00
|
|
|
数据读入前会有文本块样式。
|
|
|
|
|
2016-05-26 17:46:55 +08:00
|
|
|
## en-US
|
|
|
|
|
2016-12-06 16:46:12 +08:00
|
|
|
Shows a loading indicator while the contents of the card is being fetched.
|
2016-05-26 17:46:55 +08:00
|
|
|
|
2017-02-13 10:55:53 +08:00
|
|
|
````jsx
|
2018-08-22 23:34:36 +08:00
|
|
|
import { Skeleton, Switch, Card, Icon, Avatar } from 'antd';
|
2018-04-20 10:44:33 +08:00
|
|
|
|
2018-08-22 23:34:36 +08:00
|
|
|
const { Meta } = Card;
|
|
|
|
|
|
|
|
class App extends React.Component {
|
2018-04-20 10:44:33 +08:00
|
|
|
state = {
|
|
|
|
loading: true,
|
|
|
|
}
|
|
|
|
|
2018-08-22 23:34:36 +08:00
|
|
|
onChange = (checked) => {
|
|
|
|
this.setState({ loading: !checked });
|
2018-04-20 10:44:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2018-08-22 23:34:36 +08:00
|
|
|
const { loading } = this.state;
|
|
|
|
|
2018-04-20 10:44:33 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2018-08-22 23:34:36 +08:00
|
|
|
<Switch checked={!loading} onChange={this.onChange} />
|
|
|
|
|
|
|
|
<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>
|
2018-04-20 10:44:33 +08:00
|
|
|
</Card>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-02-22 16:25:13 +08:00
|
|
|
|
2018-08-22 23:34:36 +08:00
|
|
|
ReactDOM.render(<App />, mountNode);
|
2016-02-22 16:25:13 +08:00
|
|
|
````
|