diff --git a/components/vc-tree/src/TreeNode.jsx b/components/vc-tree/src/TreeNode.jsx index 7b679a509..ff6b65551 100644 --- a/components/vc-tree/src/TreeNode.jsx +++ b/components/vc-tree/src/TreeNode.jsx @@ -345,7 +345,7 @@ const TreeNode = { class={classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher-noop`)} > {typeof switcherIcon === 'function' - ? switcherIcon({ ...this.$props, isLeaf: true }) + ? switcherIcon({ ...this.$props, ...this.$props.dataRef, isLeaf: true }) : switcherIcon} ); @@ -358,7 +358,7 @@ const TreeNode = { return ( {typeof switcherIcon === 'function' - ? switcherIcon({ ...this.$props, isLeaf: false }) + ? switcherIcon({ ...this.$props, ...this.$props.dataRef, isLeaf: false }) : switcherIcon} ); @@ -430,7 +430,9 @@ const TreeNode = { const currentIcon = icon || treeIcon; $icon = currentIcon ? ( - {typeof currentIcon === 'function' ? currentIcon({ ...this.$props }, h) : currentIcon} + {typeof currentIcon === 'function' + ? currentIcon({ ...this.$props, ...this.$props.dataRef }, h) + : currentIcon} ) : ( this.renderIcon() @@ -442,12 +444,14 @@ const TreeNode = { const currentTitle = title; let $title = currentTitle ? ( - {typeof currentTitle === 'function' ? currentTitle({ ...this.$props }, h) : currentTitle} + {typeof currentTitle === 'function' + ? currentTitle({ ...this.$props, ...this.$props.dataRef }, h) + : currentTitle} ) : ( {defaultTitle} ); - + return (