diff --git a/components/badge/Badge.jsx b/components/badge/Badge.jsx index 56f75edb56..a70aa8083e 100644 --- a/components/badge/Badge.jsx +++ b/components/badge/Badge.jsx @@ -71,8 +71,8 @@ export default { [`${prefixCls}-not-a-wrapper`]: !children.length, }) const styleWithOffset = offset ? { - marginTop: offset[0], - marginLeft: offset[1], + marginLeft: typeof offset[0] === 'number' ? `${offset[0]}px` : offset[0], + marginTop: typeof offset[1] === 'number' ? `${offset[1]}px` : offset[1], ...numberStyle, } : numberStyle // diff --git a/components/badge/index.en_US.md b/components/badge/index.en_US.md index bc2adf5e04..bf0c0a30d6 100644 --- a/components/badge/index.en_US.md +++ b/components/badge/index.en_US.md @@ -14,7 +14,7 @@ | -------- | ----------- | ---- | ------- | | count | Number to show in badge | number\|string | | | dot | Whether to display a red dot instead of `count` | boolean | `false` | -| offset | set offset of the badge dot, like [x, y] | [number, number] | - | +| offset | set offset of the badge dot, like [x, y] | [number\|string, number\|string] | - | | overflowCount | Max count to show | number | 99 | | showZero | Whether to show badge when `count` is zero | boolean | `false` | | status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` | diff --git a/components/badge/index.zh-CN.md b/components/badge/index.zh-CN.md index ef80e48989..97f6116ce3 100644 --- a/components/badge/index.zh-CN.md +++ b/components/badge/index.zh-CN.md @@ -15,7 +15,7 @@ | --- | --- | --- | --- | | count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|string | | | dot | 不展示数字,只有一个小红点 | boolean | false | -| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - | +| offset | 设置状态点的位置偏移,格式为 [x, y] | [number\|string, number\|string] | - | | overflowCount | 展示封顶的数字值 | number | 99 | | showZero | 当数值为 0 时,是否展示 Badge | boolean | false | | status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |