diff --git a/components/vc-tree/src/TreeNode.jsx b/components/vc-tree/src/TreeNode.jsx index 112ebd763..7b679a509 100644 --- a/components/vc-tree/src/TreeNode.jsx +++ b/components/vc-tree/src/TreeNode.jsx @@ -420,7 +420,7 @@ const TreeNode = { vcTree: { prefixCls, showIcon, icon: treeIcon, draggable, loadData }, } = this; const disabled = this.isDisabled(); - const title = getComponentFromProp(this, 'title') || defaultTitle; + const title = getComponentFromProp(this, 'title', {}, false); const wrapClass = `${prefixCls}-node-content-wrapper`; // Icon - Still show loading icon when loading without showIcon @@ -439,9 +439,15 @@ const TreeNode = { $icon = this.renderIcon(); } - // Title - const $title = {title}; - + const currentTitle = title; + let $title = currentTitle ? ( + + {typeof currentTitle === 'function' ? currentTitle({ ...this.$props }, h) : currentTitle} + + ) : ( + {defaultTitle} + ); + return (