2019-11-21 20:23:56 +08:00
|
|
|
---
|
2020-06-30 13:09:04 +08:00
|
|
|
order: 2.1
|
2019-11-21 20:23:56 +08:00
|
|
|
title:
|
2020-06-30 13:09:04 +08:00
|
|
|
zh-CN: 按钮/头像/输入框/图像
|
|
|
|
en-US: Button/Avatar/Input/Image
|
2019-11-21 20:23:56 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2020-06-28 22:41:59 +08:00
|
|
|
骨架按钮、头像、输入框和图像。
|
2019-11-21 20:23:56 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2020-06-30 13:09:04 +08:00
|
|
|
Skeleton Button, Avatar, Input and Image.
|
2019-11-21 20:23:56 +08:00
|
|
|
|
|
|
|
```jsx
|
2022-01-11 15:12:03 +08:00
|
|
|
import { Skeleton, Space, Divider, Switch, Form, Radio, Button, Input } from 'antd';
|
2019-11-21 20:23:56 +08:00
|
|
|
|
|
|
|
class Demo extends React.Component {
|
|
|
|
state = {
|
2020-06-30 13:09:04 +08:00
|
|
|
active: false,
|
2021-06-10 00:38:55 +08:00
|
|
|
block: false,
|
2020-06-30 13:09:04 +08:00
|
|
|
size: 'default',
|
2019-12-03 13:33:04 +08:00
|
|
|
buttonShape: 'default',
|
|
|
|
avatarShape: 'circle',
|
2019-11-21 20:23:56 +08:00
|
|
|
};
|
|
|
|
|
2020-06-30 13:09:04 +08:00
|
|
|
handleActiveChange = checked => {
|
|
|
|
this.setState({ active: checked });
|
2019-11-21 20:23:56 +08:00
|
|
|
};
|
|
|
|
|
2021-06-10 00:38:55 +08:00
|
|
|
handleBlockChange = checked => {
|
|
|
|
this.setState({ block: checked });
|
|
|
|
};
|
|
|
|
|
2020-06-30 13:09:04 +08:00
|
|
|
handleSizeChange = e => {
|
|
|
|
this.setState({ size: e.target.value });
|
2019-11-21 20:23:56 +08:00
|
|
|
};
|
|
|
|
|
2019-12-03 13:33:04 +08:00
|
|
|
handleShapeChange = prop => e => {
|
|
|
|
this.setState({ [prop]: e.target.value });
|
2019-11-21 20:23:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2021-06-10 00:38:55 +08:00
|
|
|
const { active, size, buttonShape, avatarShape, block } = this.state;
|
2019-11-21 20:23:56 +08:00
|
|
|
return (
|
2020-06-30 13:09:04 +08:00
|
|
|
<>
|
|
|
|
<Space>
|
2021-06-10 00:38:55 +08:00
|
|
|
<Skeleton.Button active={active} size={size} shape={buttonShape} block={block} />
|
2020-06-30 13:09:04 +08:00
|
|
|
<Skeleton.Avatar active={active} size={size} shape={avatarShape} />
|
2022-01-11 15:12:03 +08:00
|
|
|
<Skeleton.Input active={active} size={size} />
|
2020-06-30 13:09:04 +08:00
|
|
|
</Space>
|
2019-12-19 11:56:50 +08:00
|
|
|
<br />
|
2020-06-28 22:41:59 +08:00
|
|
|
<br />
|
2021-06-10 00:38:55 +08:00
|
|
|
<Skeleton.Button active={active} size={size} shape={buttonShape} block={block} />
|
|
|
|
<br />
|
|
|
|
<br />
|
2022-01-11 15:12:03 +08:00
|
|
|
<Skeleton.Input active={active} size={size} block={block} />
|
|
|
|
<br />
|
|
|
|
<br />
|
2020-06-30 13:09:04 +08:00
|
|
|
<Skeleton.Image />
|
|
|
|
<Divider />
|
|
|
|
<Form layout="inline" style={{ margin: '16px 0' }}>
|
|
|
|
<Form.Item label="Active">
|
|
|
|
<Switch checked={active} onChange={this.handleActiveChange} />
|
|
|
|
</Form.Item>
|
2022-01-11 15:12:03 +08:00
|
|
|
<Form.Item label="Button and Input Block">
|
2021-06-10 00:38:55 +08:00
|
|
|
<Switch checked={block} onChange={this.handleBlockChange} />
|
|
|
|
</Form.Item>
|
2020-06-30 13:09:04 +08:00
|
|
|
<Form.Item label="Size">
|
|
|
|
<Radio.Group value={size} onChange={this.handleSizeChange}>
|
|
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item label="Button Shape">
|
|
|
|
<Radio.Group value={buttonShape} onChange={this.handleShapeChange('buttonShape')}>
|
|
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
|
|
<Radio.Button value="round">Round</Radio.Button>
|
|
|
|
<Radio.Button value="circle">Circle</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item label="Avatar Shape">
|
|
|
|
<Radio.Group value={avatarShape} onChange={this.handleShapeChange('avatarShape')}>
|
|
|
|
<Radio.Button value="square">Square</Radio.Button>
|
|
|
|
<Radio.Button value="circle">Circle</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
</>
|
2019-11-21 20:23:56 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default Demo;
|
2019-11-21 20:23:56 +08:00
|
|
|
```
|