forked from AkkomaGang/admin-fe
Add badge for displating open reports count
This commit is contained in:
parent
08bd5dae40
commit
49df2deb31
1 changed files with 16 additions and 19 deletions
|
@ -1,7 +1,14 @@
|
||||||
|
<template>
|
||||||
|
<span>
|
||||||
|
<svg-icon :icon-class="icon"/>
|
||||||
|
<span slot="title">{{ title }}</span>
|
||||||
|
<el-badge :value="count" type="primary" class="count-badge" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'MenuItem',
|
name: 'Item',
|
||||||
functional: true,
|
|
||||||
props: {
|
props: {
|
||||||
count: {
|
count: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -15,23 +22,13 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
|
||||||
render(h, context) {
|
|
||||||
const { count, icon, title } = context.props
|
|
||||||
const vnodes = []
|
|
||||||
|
|
||||||
if (icon) {
|
|
||||||
vnodes.push(<svg-icon icon-class={icon}/>)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (title) {
|
|
||||||
vnodes.push(<span slot='title'>{(title)} </span>)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count) {
|
|
||||||
vnodes.push(<span slot='title'>({(count)})</span>)
|
|
||||||
}
|
|
||||||
return vnodes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style rel='stylesheet/scss' lang='scss' scoped>
|
||||||
|
.count-badge {
|
||||||
|
margin-left: 5px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue