diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 8e530860eb36..3703d4cb787e 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -194,28 +194,28 @@ export default class Tree extends React.Component { if (loading) { return ; } - if (showLine) { - if (isLeaf) { + if (isLeaf) { + if (showLine) { return ; } - return ( - - ); - } - const switcherCls = `${prefixCls}-switcher-icon`; - if (isLeaf) { return null; } + const switcherCls = `${prefixCls}-switcher-icon`; if (switcherIcon) { const switcherOriginCls = switcherIcon.props.className || ''; return React.cloneElement(switcherIcon, { className: classNames(switcherOriginCls, switcherCls), }); } + if (showLine) { + return ( + + ); + } return ; };