Commit c639474f authored by cinwell.li's avatar cinwell.li Committed by FuryBean

Badge: add hidden prop, close #2042 (#2050)

parent 47e75ad0
...@@ -134,4 +134,5 @@ Use a red dot to mark content that needs to be noticed. ...@@ -134,4 +134,5 @@ Use a red dot to mark content that needs to be noticed.
|------------- |---------------- |---------------- |---------------------- |-------- | |------------- |---------------- |---------------- |---------------------- |-------- |
| value | display value | string, number | — | — | | value | display value | string, number | — | — |
| max | maximum value, shows '{max}+' when exceeded. Only works if `value` is a `Number` | number | — | — | | max | maximum value, shows '{max}+' when exceeded. Only works if `value` is a `Number` | number | — | — |
| is-dot | if a little dot is displayed | boolean | — | false | | is-dot | if a little dot is displayed | boolean | — | false |
\ No newline at end of file | hidden | hidden badge | boolean | - | false |
...@@ -137,3 +137,4 @@ ...@@ -137,3 +137,4 @@
| value | 显示值 | string, number | — | — | | value | 显示值 | string, number | — | — |
| max | 最大值,超过最大值会显示 '{max}+',要求 value 是 Number 类型 | number | — | — | | max | 最大值,超过最大值会显示 '{max}+',要求 value 是 Number 类型 | number | — | — |
| is-dot | 小圆点 | boolean | — | false | | is-dot | 小圆点 | boolean | — | false |
| hidden | 隐藏 badge | boolean | - | false |
<template> <template>
<div class="el-badge"> <div class="el-badge">
<slot></slot> <slot></slot>
<sup <transition name="el-zoom-in-center">
v-text="content" <sup
class="el-badge__content" v-show="!hidden"
:class="{ 'is-fixed': $slots.default, 'is-dot': isDot }"> v-text="content"
</sup> class="el-badge__content"
:class="{ 'is-fixed': $slots.default, 'is-dot': isDot }">
</sup>
</transition>
</div> </div>
</template> </template>
...@@ -16,7 +19,8 @@ export default { ...@@ -16,7 +19,8 @@ export default {
props: { props: {
value: {}, value: {},
max: Number, max: Number,
isDot: Boolean isDot: Boolean,
hidden: Boolean
}, },
computed: { computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment