Badge add status

This commit is contained in:
梁灏 2018-06-21 11:47:10 +08:00
parent fdafcd2cc5
commit 0823f88b2d
4 changed files with 90 additions and 0 deletions

View file

@ -3,6 +3,10 @@
<slot></slot>
<sup :class="dotClasses" v-show="badge"></sup>
</span>
<span v-else-if="status" :class="classes" class="ivu-badge-status" ref="badge">
<span :class="statusClasses"></span>
<span class="ivu-badge-status-text">{{ text }}</span>
</span>
<span v-else :class="classes" ref="badge">
<slot></slot>
<sup v-if="hasCount" :class="countClasses" v-show="badge">{{ finalCount }}</sup>
@ -58,6 +62,14 @@
}
];
},
statusClasses () {
return [
`${prefixCls}-status-dot`,
{
[`${prefixCls}-status-${this.status}`]: !!this.status
}
];
},
finalCount () {
if (this.text !== '') return this.text;
return parseInt(this.count) >= parseInt(this.overflowCount) ? `${this.overflowCount}+` : this.count;