2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-12-20 11:06:40 +08:00
|
|
|
order: 1
|
2016-07-11 11:45:42 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 独立使用
|
|
|
|
en-US: Standalone
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-18 17:27:22 +08:00
|
|
|
|
2016-07-11 11:45:42 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-12-18 17:27:22 +08:00
|
|
|
不包裹任何元素即是独立使用,可自定样式展现。
|
|
|
|
|
|
|
|
> 在右上角的 badge 则限定为红色。
|
|
|
|
|
2016-07-11 11:45:42 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Used in standalone when children is empty.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2021-01-28 18:16:05 +08:00
|
|
|
import { ClockCircleOutlined } from '@ant-design/icons';
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Badge, Space, Switch } from 'antd';
|
|
|
|
import React, { useState } from 'react';
|
2020-12-07 21:23:42 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [show, setShow] = useState(true);
|
2020-12-07 21:23:42 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Space>
|
2021-08-02 12:22:30 +08:00
|
|
|
<Switch checked={show} onChange={() => setShow(!show)} />
|
2020-12-07 21:23:42 +08:00
|
|
|
<Badge count={show ? 25 : 0} />
|
2021-01-28 18:16:05 +08:00
|
|
|
<Badge count={show ? <ClockCircleOutlined style={{ color: '#f5222d' }} /> : 0} />
|
2020-12-07 21:23:42 +08:00
|
|
|
<Badge
|
|
|
|
className="site-badge-count-109"
|
|
|
|
count={show ? 109 : 0}
|
|
|
|
style={{ backgroundColor: '#52c41a' }}
|
|
|
|
/>
|
|
|
|
</Space>
|
|
|
|
);
|
|
|
|
};
|
2020-11-25 19:49:44 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|