2020-06-06 13:20:09 +08:00
|
|
|
---
|
2021-08-02 12:22:30 +08:00
|
|
|
order: 6
|
2020-06-06 13:20:09 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 自定义位置偏移
|
|
|
|
en-US: Offset
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
设置状态点的位置偏移,格式为 `[left, top]`,表示状态点距默认位置左侧、上方的偏移量。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Set offset of the badge dot, the format is `[left, top]`, which represents the offset of the status dot from the left and top of the default position.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Avatar, Badge } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2020-06-06 13:20:09 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2021-08-02 12:22:30 +08:00
|
|
|
<Badge count={5} offset={[10, 10]}>
|
|
|
|
<Avatar shape="square" size="large" />
|
2022-04-03 23:27:45 +08:00
|
|
|
</Badge>
|
2020-06-06 13:20:09 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2020-06-06 13:20:09 +08:00
|
|
|
```
|