Skip to content

Commit e6054ff

Browse files
committed
fix: badge offset x y axis order error and support number type #99
1 parent becdaf2 commit e6054ff

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

components/badge/Badge.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export default {
7171
[`${prefixCls}-not-a-wrapper`]: !children.length,
7272
})
7373
const styleWithOffset = offset ? {
74-
marginTop: offset[0],
75-
marginLeft: offset[1],
74+
marginLeft: typeof offset[0] === 'number' ? `${offset[0]}px` : offset[0],
75+
marginTop: typeof offset[1] === 'number' ? `${offset[1]}px` : offset[1],
7676
...numberStyle,
7777
} : numberStyle
7878
// <Badge status="success" />

components/badge/index.en_US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| -------- | ----------- | ---- | ------- |
1515
| count | Number to show in badge | number\|string | |
1616
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
17-
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |
17+
| offset | set offset of the badge dot, like [x, y] | [number\|string, number\|string] | - |
1818
| overflowCount | Max count to show | number | 99 |
1919
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
2020
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |

components/badge/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| --- | --- | --- | --- |
1616
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|string | |
1717
| dot | 不展示数字,只有一个小红点 | boolean | false |
18-
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |
18+
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number\|string, number\|string] | - |
1919
| overflowCount | 展示封顶的数字值 | number | 99 |
2020
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
2121
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |

0 commit comments

Comments
 (0)