feat(TreeSelect): add badge option, mark info option as deprecated

This commit is contained in:
chenjiahan
2020-03-17 21:09:22 +08:00
parent 214b13b8ff
commit 0cc7a30528
5 changed files with 19 additions and 18 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
// Utils
import { createNamespace, addUnit } from '../utils';
import { createNamespace, addUnit, isDef } from '../utils';
import { emit, inherit } from '../utils/functional';
// Components
@@ -15,6 +15,7 @@ export type TreeSelectItem = {
text: string;
dot?: boolean;
info?: string | number;
badge?: string | number;
disabled?: boolean;
className?: any;
children: TreeSelectChildren[];
@@ -63,7 +64,7 @@ function TreeSelect(
const Navs = items.map(item => (
<SidebarItem
dot={item.dot}
info={item.info}
info={isDef(item.badge) ? item.badge : item.info}
title={item.text}
disabled={item.disabled}
class={[bem('nav-item'), item.className]}