From 6d40875b67b29c0746f22a259f036bd887a799b1 Mon Sep 17 00:00:00 2001 From: decarp Date: Thu, 4 Nov 2021 13:54:26 +0800 Subject: [PATCH] =?UTF-8?q?inputTree=E7=9A=84icon=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20(#2851)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * inputTree的icon显示修复;并补充文档 * 防止使用fa的时候多次渲染 * 兼容了下使用其他图标 Co-authored-by: zhyc --- src/components/Tree.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Tree.tsx b/src/components/Tree.tsx index 61316611e..28bd87e92 100644 --- a/src/components/Tree.tsx +++ b/src/components/Tree.tsx @@ -19,7 +19,7 @@ import { import {Option, Options, value2array} from './Select'; import {ClassNamesFn, themeable, ThemeProps} from '../theme'; import {highlight} from '../renderers/Form/Options'; -import {Icon} from './icons'; +import {Icon, getIcon} from './icons'; import Checkbox from './Checkbox'; import {LocaleProps, localeable} from '../locale'; import Spinner from './Spinner'; @@ -710,6 +710,8 @@ export class TreeSelector extends React.Component< const isLeaf = (!item.children || !item.children.length) && !item.placeholder; + const iconValue = item[iconField] || (childrenItems ? 'folder' : 'file'); + return (
  • - + {getIcon(iconValue) + ? + : } ) : null}