mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
inputTree的icon显示修复 (#2851)
* inputTree的icon显示修复;并补充文档 * 防止使用fa的时候多次渲染 * 兼容了下使用其他图标 Co-authored-by: zhyc <zhyc@hzsuoyi.com>
This commit is contained in:
parent
a9446ed34c
commit
6d40875b67
@ -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 (
|
||||
<li
|
||||
key={key}
|
||||
@ -754,7 +756,6 @@ export class TreeSelector extends React.Component<
|
||||
<i
|
||||
className={cx(
|
||||
`Tree-itemIcon ${
|
||||
item[iconField] ||
|
||||
(childrenItems ? 'Tree-folderIcon' : 'Tree-leafIcon')
|
||||
}`
|
||||
)}
|
||||
@ -765,10 +766,9 @@ export class TreeSelector extends React.Component<
|
||||
: this.handleSelect(item))
|
||||
}
|
||||
>
|
||||
<Icon
|
||||
icon={item[iconField] || (childrenItems ? 'folder' : 'file')}
|
||||
className="icon"
|
||||
/>
|
||||
{getIcon(iconValue)
|
||||
? <Icon icon={iconValue} className="icon"/>
|
||||
: <i className={iconValue}></i>}
|
||||
</i>
|
||||
) : null}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user