fix: badge offset x y axis order error and support number type #99

pull/165/head
tangjinzhou 2018-08-08 09:44:00 +08:00
parent f31043a3b3
commit 4021693893
3 changed files with 4 additions and 4 deletions

View File

@ -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
// <Badge status="success" />

View File

@ -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` | `''` |

View File

@ -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' } | '' |