Badge add new slot: text

This commit is contained in:
梁灏 2019-09-05 11:23:01 +08:00
parent ed0817359c
commit b321e1abca
2 changed files with 13 additions and 2 deletions

View file

@ -25,6 +25,14 @@
<a href="#" class="demo-badge"></a>
</Badge>
<Button @click="setCount">set count</Button>
<Divider></Divider>
<Badge :count="count" text="new">
<a href="#" class="demo-badge"></a>
</Badge>
<Badge :count="count">
<a href="#" class="demo-badge"></a>
<span slot="text">hhh</span>
</Badge>
<br><br>
<Badge text="hot">
<Button type="primary" ghost>Hello</Button>
@ -38,6 +46,9 @@
<Badge status="warning" />
<br />
<Badge status="success" text="Success" />
<Badge status="success">
<strong slot="text">Success</strong>
</Badge>
<br />
<Badge status="error" text="Error" />
<br />

View file

@ -5,12 +5,12 @@
</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 class="ivu-badge-status-text"><slot name="text">{{ text }}</slot></span>
</span>
<span v-else :class="classes" ref="badge">
<slot></slot>
<sup v-if="$slots.count" :style="styles" :class="customCountClasses"><slot name="count"></slot></sup>
<sup v-else-if="hasCount" :style="styles" :class="countClasses" v-show="badge">{{ finalCount }}</sup>
<sup v-else-if="hasCount" :style="styles" :class="countClasses" v-show="badge"><slot name="text">{{ finalCount }}</slot></sup>
</span>
</template>
<script>