feat(SidebarItem): add badge prop, mark info prop as deprecated

This commit is contained in:
chenjiahan
2020-03-17 20:52:14 +08:00
parent d61cbdd086
commit 01482f20bc
4 changed files with 22 additions and 16 deletions
+7 -2
View File
@@ -1,4 +1,4 @@
import { createNamespace } from '../utils';
import { createNamespace, isDef } from '../utils';
import { ChildrenMixin } from '../mixins/relation';
import { route, routeProps } from '../utils/router';
import Info from '../info';
@@ -12,6 +12,7 @@ export default createComponent({
...routeProps,
dot: Boolean,
info: [Number, String],
badge: [Number, String],
title: String,
disabled: Boolean,
},
@@ -43,7 +44,11 @@ export default createComponent({
>
<div class={bem('text')}>
{this.title}
<Info dot={this.dot} info={this.info} class={bem('info')} />
<Info
dot={this.dot}
info={isDef(this.badge) ? this.badge : this.info}
class={bem('info')}
/>
</div>
</a>
);