2019-03-31 20:21:20 +08:00
|
|
|
---
|
|
|
|
order: 8
|
|
|
|
title:
|
|
|
|
zh-CN: 多彩徽标
|
|
|
|
en-US: Colorful Badge
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2020-03-17 17:13:16 +08:00
|
|
|
我们添加了多种预设色彩的徽标样式,用作不同场景使用。如果预设值不能满足你的需求,可以设置为具体的色值。
|
2019-03-31 20:21:20 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2020-03-17 17:13:16 +08:00
|
|
|
We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.
|
2019-03-31 20:21:20 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2020-05-25 18:59:00 +08:00
|
|
|
import { Badge, Divider } from 'antd';
|
2019-03-31 20:21:20 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
const colors = [
|
|
|
|
'pink',
|
|
|
|
'red',
|
|
|
|
'yellow',
|
|
|
|
'orange',
|
|
|
|
'cyan',
|
|
|
|
'green',
|
|
|
|
'blue',
|
|
|
|
'purple',
|
|
|
|
'geekblue',
|
|
|
|
'magenta',
|
|
|
|
'volcano',
|
|
|
|
'gold',
|
|
|
|
'lime',
|
|
|
|
];
|
2019-03-31 20:21:20 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2020-05-25 18:59:00 +08:00
|
|
|
<>
|
|
|
|
<Divider orientation="left">Presets</Divider>
|
2019-03-31 20:21:20 +08:00
|
|
|
<div>
|
2019-05-07 14:57:32 +08:00
|
|
|
{colors.map(color => (
|
2019-03-31 20:21:20 +08:00
|
|
|
<div key={color}>
|
|
|
|
<Badge color={color} text={color} />
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
2020-05-25 18:59:00 +08:00
|
|
|
<Divider orientation="left">Custom</Divider>
|
2019-03-31 20:21:20 +08:00
|
|
|
<div>
|
|
|
|
<Badge color="#f50" text="#f50" />
|
|
|
|
<br />
|
|
|
|
<Badge color="#2db7f5" text="#2db7f5" />
|
|
|
|
<br />
|
|
|
|
<Badge color="#87d068" text="#87d068" />
|
|
|
|
<br />
|
|
|
|
<Badge color="#108ee9" text="#108ee9" />
|
|
|
|
</div>
|
2020-05-25 18:59:00 +08:00
|
|
|
</>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
2019-03-31 20:21:20 +08:00
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2019-03-31 20:21:20 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```css
|
2019-03-31 20:21:20 +08:00
|
|
|
.ant-tag {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|