Support Badge

Support Badge
This commit is contained in:
梁灏 2017-03-02 12:05:57 +08:00
parent 5d122b374c
commit 15368be172
7 changed files with 66 additions and 9 deletions

View file

@ -1,9 +1,9 @@
<template>
<span v-if="dot" :class="classes" v-el:badge>
<span v-if="dot" :class="classes" ref="badge">
<slot></slot>
<sup :class="dotClasses" v-show="badge"></sup>
</span>
<span v-else :class="classes" v-el:badge>
<span v-else :class="classes" ref="badge">
<slot></slot>
<sup v-if="count" :class="countClasses" v-show="badge">{{ finalCount }}</sup>
</span>
@ -22,7 +22,7 @@
type: [Number, String],
default: 99
},
class: String
className: String
},
computed: {
classes () {
@ -35,7 +35,7 @@
return [
`${prefixCls}-count`,
{
[`${this.class}`]: !!this.class,
[`${this.className}`]: !!this.className,
[`${prefixCls}-count-alone`]: this.alone
}
];
@ -68,7 +68,7 @@
};
},
compiled () {
const child_length = this.$els.badge.children.length;
const child_length = this.$refs.badge.children.length;
if (child_length === 1) {
this.alone = true;
}