Skip to content

Commit 1a61d1f

Browse files
committed
fix: tree custom icon not work
1 parent 43c961c commit 1a61d1f

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

antdv-demo

components/tree/Tree.jsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,9 @@ export default {
162162
const { on = {}, slots = {}, scopedSlots = {}, class: cls, style, ...restProps } = item;
163163
const treeNodeProps = {
164164
...restProps,
165-
icon:
166-
($scopedSlots[scopedSlots.icon] && $scopedSlots[scopedSlots.icon](item)) ||
167-
$slots[slots.icon] ||
168-
restProps.icon,
165+
icon: $scopedSlots[scopedSlots.icon] || $slots[slots.icon] || restProps.icon,
169166
switcherIcon:
170-
($scopedSlots[scopedSlots.switcherIcon] &&
171-
$scopedSlots[scopedSlots.switcherIcon](item)) ||
167+
$scopedSlots[scopedSlots.switcherIcon] ||
172168
$slots[slots.switcherIcon] ||
173169
restProps.switcherIcon,
174170
title:

components/vc-tree/src/TreeNode.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ const TreeNode = {
416416
// Icon + Title
417417
renderSelector(h) {
418418
const { selected, loading, dragNodeHighlight } = this;
419-
const icon = getComponentFromProp(this, 'icon');
419+
const icon = getComponentFromProp(this, 'icon', {}, false);
420420
const {
421421
vcTree: { prefixCls, showIcon, icon: treeIcon, draggable, loadData },
422422
} = this;

0 commit comments

Comments
 (0)