From 0cc7a305287f43314910f893092c09004cef5349 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 17 Mar 2020 21:09:22 +0800 Subject: [PATCH] feat(TreeSelect): add badge option, mark info option as deprecated --- src/sidebar/test/__snapshots__/demo.spec.js.snap | 2 +- src/tree-select/README.md | 8 ++++---- src/tree-select/README.zh-CN.md | 10 +++++----- src/tree-select/demo/index.vue | 12 ++++++------ src/tree-select/index.tsx | 5 +++-- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/sidebar/test/__snapshots__/demo.spec.js.snap b/src/sidebar/test/__snapshots__/demo.spec.js.snap index ced2ae01f..1a7caf7b3 100644 --- a/src/sidebar/test/__snapshots__/demo.spec.js.snap +++ b/src/sidebar/test/__snapshots__/demo.spec.js.snap @@ -23,7 +23,7 @@ exports[`renders demo correctly 1`] = `
-

提示信息

+

徽标提示

标签名
diff --git a/src/tree-select/README.md b/src/tree-select/README.md index f636ad4ba..d2e182679 100644 --- a/src/tree-select/README.md +++ b/src/tree-select/README.md @@ -81,7 +81,7 @@ export default { } ``` -### Show Info +### Show Badge ```html - + @@ -54,7 +54,7 @@ import { deepClone } from '../../utils/deep-clone'; export default { i18n: { 'zh-CN': { - showInfo: '提示信息', + showBadge: '提示信息', radioMode: '单选模式', multipleMode: '多选模式', customContent: '自定义内容', @@ -62,7 +62,7 @@ export default { dataSimple: [{ text: '分组 1' }, { text: '分组 2' }], }, 'en-US': { - showInfo: 'Show Info', + showBadge: 'Show Badge', radioMode: 'Radio Mode', multipleMode: 'Multiple Mode', customContent: 'Custom Content', @@ -92,11 +92,11 @@ export default { return this.$t('dataSimple'); }, - infoItems() { + badgeItems() { const data = deepClone(this.$t('data')).slice(0, 2); data[0].dot = true; - data[1].info = 5; + data[1].badge = 5; return data; }, diff --git a/src/tree-select/index.tsx b/src/tree-select/index.tsx index 3a614fede..e49a94ee4 100644 --- a/src/tree-select/index.tsx +++ b/src/tree-select/index.tsx @@ -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 => (